code: def get_normalized_text(span_or_token: Span | Token) -> str:
      """
      Get the text of a spaCy span or token, normalized depending on its characteristics.
      For proper nouns and acronyms, text is returned as-is; for everything else,
      text is lemmatized.
      """
      if isinstance(span_or_token, Token):
          return (
              span_or_token.text
              if preserve_case(span_or_token)
              else span_or_token.lemma_
          )
      elif isinstance(span_or_token, Span):
          return " ".join(
              token.text if preserve_case(token) else token.lemma_
              for token in span_or_token
          )
      else:
          raise TypeError(
              errors.type_invalid_msg(
                  "span_or_token",
                  type(span_or_token),
                  Union[Span, Token],
              )
          )
  
imports: from __future__ import annotations
  import functools
  import itertools
  import pathlib
  from typing import Iterable, Union
  from cachetools import cached
  from cachetools.keys import hashkey
  from spacy import attrs
  from spacy.language import Language
  from spacy.morphology import Morphology
  from spacy.pipeline import Morphologizer
  from spacy.symbols import PROPN, VERB
  from spacy.tokens import Doc, Span, Token
  from ..None import cache, constants, errors, types, utils
  from .None import core
label_desc: Use image node_id 4 for calling a global function with example usage: get_normalized_text(span_or_token) and returns: unknown, str