input: 
  
  def sort_by_attr(objects, attr):
      """
      Sort a list of objects by a specified attribute of the objects.
      >>> sort_by_attr([{"name": "Alice", "age": 20}, {"name": "Bob", "age": 21}], "age")
      [{'age': 20, 'name': 'Alice'}, {'age': 21, 'name': 'Bob'}]
      >>> sort_by_attr([{"name": "Alice", "age": 21}, {"name": "Bob", "age": 20}], "name")
      [{'age': 20, 'name': 'Bob'}, {'age': 21, 'name': 'Alice'}]
      """
      return sorted(objects, key=lambda item: item[attr])
  
  
output:     return sorted(objects, key=lambda item: item[attr])