Write a function in Python for sorting a list of objects by an attribute 'name'.
list_of_objects = [{"name": "John", "age": 35}, {"name": "Liz", "age": 25}, {"name": "Max", "age": 28}]
def sort_by_name(lst): 
    return sorted(lst, key=lambda item: item["name"])