code: def _canonical_typename(cls):
      if "_name" in dir(cls):
          name = cls._name
      else:
          name = cls.__name__
      if name.endswith(".Config"):
          return name[: -len(".Config")]
      return name
  
imports: from enum import Enum
  from typing import Any, Dict, List, Tuple, Type, Union
  from pytext.common.utils import eprint
  from .component import Registry
  from .config_adapter import upgrade_to_latest
  from .pytext_config import PyTextConfig
label_desc: Use image node_id 1 for calling a global function with example usage: _canonical_typename(cls) and returns: name, name