code: def make_spacy_key(
      obj: Union[Token, Span],
      prefer_ents: bool = False,
      lemmatize: bool = False,
  ) -> Tuple[str, str]:
      """Create a key from a spaCy object, i.e. a Token or Span. If the object
      is a token, the part-of-speech tag (Token.pos_) is used for the sense
      and a special string is created for URLs. If the object is a Span and
      has a label (i.e. is an entity span), the label is used. Otherwise, the
      span's root part-of-speech tag becomes the sense.
  
      obj (Token / Span): The spaCy object to create the key for.
      prefer_ents (bool): Prefer entity types for single tokens (i.e.
          token.ent_type instead of tokens.pos_). Should be enabled if phrases
          are merged into single tokens, because otherwise the entity sense would
          never be used.
      lemmatize (bool): Use the object's lemma instead of its text.
      RETURNS (unicode): The key.
      """
      default_sense = "?"
      text = get_true_cased_text(obj, lemmatize=lemmatize)
      if isinstance(obj, Token):
          if obj.like_url:
              text = "%%URL"
              sense = "X"
          elif obj.ent_type_ and prefer_ents:
              sense = obj.ent_type_
          else:
              sense = obj.pos_
      elif isinstance(obj, Span):
          sense = obj.label_ or obj.root.pos_
      return (text, sense or default_sense)
  
file_path: sense2vec/sense2vec/util.py
imports: from typing import Union, List, Tuple, Set
  import re
  from spacy.tokens import Doc, Token, Span
  from spacy.util import filter_spans
  from thinc.api import get_array_module
  import catalogue
label_desc: Use image node_id 3 for calling a global function with example usage: make_spacy_key(obj, prefer_ents, lemmatize) and returns: text,  unknown