input: Write a function to group items by 'code' and store 'foo' and 'bar' values in a list of dictionaries.
  assert group_items([{'code': 'abc', 'foo': 1, 'bar': 'a'}, {'code': 'def', 'foo': 4, 'bar': 'b'}, {'code': 'ghi', 'foo': 6, 'bar': 'c'}]) == {'abc': [{'foo': 1, 'bar': 'a'}], 'def': [{'foo': 4, 'bar': 'b'}], 'ghi': [{'foo': 6, 'bar': 'c'}]}
  assert group_items([{'code': 'abc', 'foo': 2, 'bar': 'd'}, {'code': 'abc', 'foo': 3, 'bar': 'e'}]) == {'abc': [{'foo': 2, 'bar': 'd'}, {'foo': 3, 'bar': 'e'}]}
  assert group_items([{'code': 'xyz', 'foo': 7, 'bar': 'f'}, {'code': 'xyz', 'foo': 8, 'bar': 'g'}, {'code': 'xyz', 'foo': 9, 'bar': 'h'}]) == {'xyz': [{'foo': 7, 'bar': 'f'}, {'foo': 8, 'bar': 'g'}, {'foo': 9, 'bar': 'h'}]}
output: def group_items(items):
      grouped = {}
      for item in items:
          code = item['code']
          if code not in grouped:
              grouped[code] = []
          grouped[code].append({'foo': item['foo'], 'bar': item['bar']})
      return grouped