input: Write a function that takes a list of objects and a string representing the attribute to sort by, and returns a list of those objects sorted by the specified attribute.
  
  def sort_by_attr(objects, attr):
   return sorted(objects, key=lambda item: item[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": 22}, {"name": "David", "age": 23}], "name") == [{"name": "Charlie", "age": 22}, {"name": "David", "age": 23}]
  assert sort_by_attr([{"name": "Eve", "age": 24}, {"name": "Frank", "age": 25}], "age") == [{"name": "Eve", "age": 24}, {"name": "Frank", "age": 25}]
  assert sort_by_attr([{"name": "Grace", "age": 26}], "name") == [{"name": "Grace", "age": 26}]
  assert sort_by_attr([], "age") == []
output: def sort_by_attr(objects, attr):
   return sorted(objects, key=lambda item: item[attr])