code: def get_tok(self, source):
          
          if isinstance(source, str):
              return source
  
          if isinstance(source, CatalogEntry):
              return source._metadata.get('original_tok', source._tok)
  
          if isinstance(source, DataSource):
              return source.metadata.get('original_tok', source._tok)
          raise IndexError
docs: Get string token from object
  
          Strings are assumed to already be a token; if source or entry, see
          if it is a persisted thing ("original_tok" is in its metadata), else
          generate its own token.