input: Write a function to generate an inverted dictionary from a given dictionary. The inverted dictionary should map each value in the original dictionary to a list of keys that had that value. If the dictionary is empty, 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({}) == {}
  assert invert_dictionary({'a': 1, 'b': 2, 'c': 1}) == {1: ['a', 'c'], 2: ['b']}
  assert invert_dictionary({'x': 'apple', 'y': 'banana', 'z': 'apple'}) == {'apple': ['x', 'z'], 'banana': ['y']}
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