input: Write a function that takes a list of objects and returns a list of those objects sorted by one of their attributes. The function should accept two parameters: the list of objects and the attribute to sort by.
  
  def sort_by_attr(objects, attr):
      return sorted(objects, key=lambda item: item.get(attr))
  
  assert sort_by_attr([{"name": "Alice", "age": 20}, {"name": "Bob", "age": 21}], "age") == [{"name": "Alice", "age": 20}, {"name": "Bob", "age": 21}]
  assert sort_by_attr([{"name": "Charlie", "age": 19}, {"name": "Dave", "age": 22}], "age") == [{"name": "Charlie", "age": 19}, {"name": "Dave", "age": 22}]
  assert sort_by_attr([{"name": "Eve", "age": 25}, {"name": "Frank", "age": 23}], "age") == [{"name": "Frank", "age": 23}, {"name": "Eve", "age": 25}]
  assert sort_by_attr([{"name": "Grace", "age": 27}, {"name": "Heidi", "age": 27}], "age") == [{"name": "Grace", "age": 27}, {"name": "Heidi", "age": 27}]
  assert sort_by_attr([], "age") == []
output: def sort_by_attr(objects, attr):
      return sorted(objects, key=lambda item: item.get(attr))