def METHOD_NAME(identifier,
          is_html_string=HTML_STRING.match,
          is_valid_id=ID.match, dot_keywords=KEYWORDS,
          escape_unescaped_quotes=ESCAPE_UNESCAPED_QUOTES):
    r"""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('<>'))
    '"<>"'
    >>> print(quote('"'))
    "\""
    >>> print(quote('\\"'))
    "\""
    >>> print(quote('\\\\"'))
    "\\\""
    >>> print(quote('\\\\\\"'))
    "\\\""
    """
    if is_html_string(identifier) and not isinstance(identifier, NoHtml):
        pass
    elif not is_valid_id(identifier) or identifier.lower() in dot_keywords:
        return '"%s"' % escape_unescaped_quotes(identifier)
    return identifier