input: Write a python function to sort a list of dictionaries by a specified key.
  assert sort_dict_by_key([{'name': 'John', 'age': 25}, {'name': 'Jane', 'age': 20}, {'name': 'Dave', 'age': 30}], 'age') == [{'name': 'Jane', 'age': 20}, {'name': 'John', 'age': 25}, {'name': 'Dave', 'age': 30}]
  assert sort_dict_by_key([{'fruit': 'apple', 'quantity': 50}, {'fruit': 'banana', 'quantity': 30}, {'fruit': 'cherry', 'quantity': 75}], 'quantity') == [{'fruit': 'banana', 'quantity': 30}, {'fruit': 'apple', 'quantity': 50}, {'fruit': 'cherry', 'quantity': 75}]
  assert sort_dict_by_key([{'city': 'New York', 'population': 8000000}, {'city': 'Los Angeles', 'population': 4000000}, {'city': 'Chicago', 'population': 2700000}], 'city') == [{'city': 'Chicago', 'population': 2700000}, {'city': 'Los Angeles', 'population': 4000000}, {'city': 'New York', 'population': 8000000}]
output: def sort_dict_by_key(list_of_dicts, key):
      return sorted(list_of_dicts, key=lambda d: d[key])