input: Write a function to invert a dictionary so that the keys become values and the values become keys. If there are duplicate values in the original dictionary, the corresponding keys should be grouped into a list under the new value. If the input dictionary is empty, return an empty 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']}
  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