code: def expand_collection_in_dict(d, key, new_items, no_duplicates=True):
      
      if key in d:
          if no_duplicates:
              new_items = filter(lambda x: x not in d[key], new_items)
          if isinstance(d[key], set):
              map(d[key].add, new_items)
          elif isinstance(d[key], list):
              map(d[key].append, new_items)
          else:
              d[key] = d[key] + new_items
      else:
          d[key] = new_items
docs: Parameters
      d: dict
          dict in which a key will be inserted/expanded
      key: hashable
          key in d
      new_items: iterable
          d[key] will be extended with items in new_items
      no_duplicates: bool
          avoid inserting duplicates in d[key] (default: True)