parameters: (str)
docstring: r"""Quote a string for use in a cookie header.
  
      If the string does not need to be double-quoted, then just return the
      string.  Otherwise, surround the string in doublequotes and quote
      (with a \) special characters.
docstring_summary: r"""Quote a string for use in a cookie header.
docstring_tokens: r Quote a string for use in a cookie header .
function: def _quote(str):
      r"""Quote a string for use in a cookie header.
  
      If the string does not need to be double-quoted, then just return the
      string.  Otherwise, surround the string in doublequotes and quote
      (with a \) special characters.
      """
      if str is None or _is_legal_key(str):
          return str
      else:
          return '"' + str.translate(_Translator) + '"'
function_tokens: def _quote ( str ) : if str is None or _is_legal_key ( str ) : return str else : return '"' + str . translate ( _Translator ) + '"'