code: def escape(s, quote=None):
      
      if s is None:
          return ''
      elif hasattr(s, '__html__'):
          return text_type(s.__html__())
      elif not isinstance(s, string_types):
          s = text_type(s)
      if quote is not None:
          from warnings import warn
          warn(DeprecationWarning('quote parameter is implicit now'), stacklevel=2)
      s = s.replace('&', '&amp;').replace('<', '&lt;') \
          .replace('>', '&gt;').replace('"', "&quot;")
      return s
docs: Replace special characters "&", "<", ">" and (") to HTML-safe sequences.
  
      There is a special handling for `None` which escapes to an empty string.
  
      .. versionchanged:: 0.9
         `quote` is now implicitly on.
  
      :param s: the string to escape.
      :param quote: ignored.