input: Write a function to sort a list of dictionaries by a key in each dictionary. The function should accept a list of dictionaries and a key, and return the sorted list based on the specified key. If the key does not exist in any dictionary, the function should handle the exception gracefully without crashing. 
  
  def sort_list_of_dicts_by_key(my_list, key):
      try:
          return sorted(my_list, key=lambda k: k[key])
      except KeyError:
          return "One or more dictionaries do not contain the specified key"
  
  assert sort_list_of_dicts_by_key([{'name': 'Tom', 'age': 25}, {'name': 'John', 'age': 21}, {'name': 'Adam', 'age': 26}], 'age')==[{'name': 'John', 'age': 21}, {'name': 'Tom', 'age': 25}, {'name': 'Adam', 'age': 26}]
  assert sort_list_of_dicts_by_key([{'name': 'Tom', 'age': 25}, {'name': 'John', 'age': 21}, {'name': 'Adam', 'age': 26}], 'name')==[{'name': 'Adam', 'age': 26}, {'name': 'John', 'age': 21}, {'name': 'Tom', 'age': 25}]
  assert sort_list_of_dicts_by_key([{'name': 'Tom', 'age': 25}, {'name': 'John', 'age': 21}], 'height')=="One or more dictionaries do not contain the specified key"
output: def sort_list_of_dicts_by_key(my_list, key):
      try:
          return sorted(my_list, key=lambda k: k[key])
      except KeyError:
          return "One or more dictionaries do not contain the specified key"