input: Write a python function to sort a list of dictionaries by a given key.
  assert sort_list_of_dicts([{'name': 'Alice', 'age': 25}, {'name': 'Bob', 'age': 20}], 'age') == [{'name': 'Bob', 'age': 20}, {'name': 'Alice', 'age': 25}]
  assert sort_list_of_dicts([{'name': 'Charlie', 'score': 90}, {'name': 'Dave', 'score': 95}], 'score') == [{'name': 'Charlie', 'score': 90}, {'name': 'Dave', 'score': 95}]
  assert sort_list_of_dicts([{'city': 'New York', 'population': 8000000}, {'city': 'Los Angeles', 'population': 4000000}], 'population') == [{'city': 'Los Angeles', 'population': 4000000}, {'city': 'New York', 'population': 8000000}]
output: def sort_list_of_dicts(list_of_dicts, key):
      return sorted(list_of_dicts, key=lambda x: x[key])