input: Write a function that takes a dictionary as an argument and returns an inverted dictionary where the keys and values are swapped. If a value appears more than once in the original dictionary, it should appear as a list of keys in the inverted dictionary. If the input dictionary is empty, return an empty dictionary.
  
  assert invert_dictionary({'a': 1, 'b': 2, 'c': 3})=={1: ['a'], 2: ['b'], 3: ['c']}
  assert invert_dictionary({'a': 1, 'b': 2, 'c': 1})=={1: ['a', 'c'], 2: ['b']}
  assert invert_dictionary({'a': 1, 'b': 1, 'c': 1})=={1: ['a', 'b', 'c']}
  assert invert_dictionary({'a': 'x', 'b': 'y', 'c': 'x'})=={'x': ['a', 'c'], 'y': ['b']}
  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