code: def _gather_keys_by_type(self, type):
          
          foreign = self._foreign_key
  
          keys = (
              BaseCollection.make(list(self._dictionary[type].values()))
              .map(lambda models: getattr(models[0], foreign))
              .unique()
          )
  
          return keys
docs: Gather all of the foreign keys for a given type.
  
          :param type: The type
          :type type: str
  
          :rtype: BaseCollection