input: Write a function to create an inverted dictionary where the keys and values are swapped. If a value appears multiple times in the original dictionary, the inverted dictionary should store a list of all keys that had that value in the original dictionary. The function should return the inverted dictionary.
  
  assert invert_dictionary({'a': 1, 'b': 2, 'c': 1}) == {1: ['a', 'c'], 2: ['b']}
  assert invert_dictionary({'x': 'A', 'y': 'B', 'z': 'A'}) == {'A': ['x', 'z'], 'B': ['y']}
  assert invert_dictionary({}) == {}
output: def invert_dictionary(d):
      inverted = {}
      for key, value in d.items():
          if value in inverted:
              inverted[value].append(key)
          else:
              inverted[value] = [key]
      return inverted