code: def quote_edge(identifier: str) -> str:
      """Return DOT edge statement node_id from string, quote if needed.
  
      >>> quote_edge('spam')
      'spam'
  
      >>> quote_edge('spam spam:eggs eggs')
      '"spam spam":"eggs eggs"'
  
      >>> quote_edge('spam:eggs:s')
      'spam:eggs:s'
      """
      node, _, rest = identifier.partition(":")
      parts = [quote(node)]
      if rest:
          port, _, compass = rest.partition(":")
          parts.append(quote(port))
          if compass:
              parts.append(compass)
      return ":".join(parts)
  
file_path: catboost/contrib/python/graphviz/py3/graphviz/lang.py
imports: import functools
  import re
  import typing
  from .None import tools
label_desc: Use image node_id 2 for calling a global function with example usage: quote_edge(identifier) and returns: str