docs: def calculate_canonical_name(data: BaseEntity) -> str:
      """Calculate the canonical name for a given node.
  
      If it is a simple node, uses the already given name. Otherwise, it uses the BEL string.
      """
      if data[FUNCTION] == COMPLEX and NAMESPACE in data:
          return data[NAME]
  
      if VARIANTS in data:
          return data.as_bel()
  
      if FUSION in data:
          return data.as_bel()
  
      if data[FUNCTION] in {REACTION, COMPOSITE, COMPLEX}:
          return data.as_bel()
  
      if VARIANTS not in data and FUSION not in data:  # this is should be a simple node
          if IDENTIFIER in data and NAME in data:
              return '{namespace}:{identifier} ({name})'.format(**data)
  
          if IDENTIFIER in data:
              return '{namespace}:{identifier}'.format(namespace=data[NAMESPACE], identifier=data[IDENTIFIER])
  
          return data[NAME]
  
      raise ValueError('Unexpected node data: {}'.format(data))