code: def quote(identifier,
            html=HTML_STRING.match, valid_id=ID.match, dot_keywords=KEYWORDS):
      
      if html(identifier) and not isinstance(identifier, NoHtml):
          pass
      elif not valid_id(identifier) or identifier.lower() in dot_keywords:
          return '"%s"' % identifier.replace('"', '\\"')
      return identifier
docs: Return DOT identifier from string, quote if needed.
  
      >>> quote('')
      '""'
  
      >>> quote('spam')
      'spam'
  
      >>> quote('spam spam')
      '"spam spam"'
  
      >>> quote('-4.2')
      '-4.2'
  
      >>> quote('.42')
      '.42'
  
      >>> quote('<<b>spam</b>>')
      '<<b>spam</b>>'
  
      >>> quote(nohtml('<>'))
      '"<>"'