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