code: def invert_map(mapping: dict, one_to_one: bool = True) -> dict:
      
      if one_to_one:
          inv_map = {value: key for key, value in mapping.items()}
      else:
          inv_map = {}
          for key, value in mapping.items():
              inv_map.setdefault(value, set()).add(key)
  
      return inv_map
docs: Invert a dictionary. If not one_to_one then the inverted
      map will contain lists of former keys as values.