code: def quote_edge(identifier):
      
      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)
docs: 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'