input: Write a function to reverse the given dictionary by swapping keys and values. If a value in the original dictionary appears more than once, the keys corresponding to that value should be stored in a list in the new dictionary. If the input dictionary is empty, the function should return an empty dictionary.
  def invert_dictionary(d):
      inverted_d = {}
  
      for key, value in d.items():
          if value not in inverted_d:
              inverted_d[value] = []
          inverted_d[value].append(key)
  
      return inverted_d
  
  assert invert_dictionary({'a': 1, 'b': 2, 'c': 1})=={1: ['a', 'c'], 2: ['b']}
  assert invert_dictionary({'x': 'y', 'z': 'y'})=={'y': ['x', 'z']}
  assert invert_dictionary({})=={}
output: def invert_dictionary(d):
      inverted_d = {}
  
      for key, value in d.items():
          if value not in inverted_d:
              inverted_d[value] = []
          inverted_d[value].append(key)
  
      return inverted_d