code: def escape(data, quote=True):  # stoled from std lib cgi
    '''
    Escapes special characters into their html entities
    Replace special characters "&", "<" and ">" to HTML-safe sequences.
    If the optional flag quote is true, the quotation mark character (")
    is also translated.
  
    This is used to escape content that appears in the body of an HTML cocument
    '''
    data = data.replace("&", "&amp;")  # Must be done first!
    data = data.replace("<", "&lt;")
    data = data.replace(">", "&gt;")
    if quote:
      data = data.replace('"', "&quot;")
    return datf escape(data, quote=True):  # stoled from std lib cgi
    '''
    Escapes special characters into their html entities
    Replace special characters "&", "<" and ">" to HTML-safe sequences.
    If the optional flag quote is true, the quotation mark character (")
    is also translated.
  
    This is used to escape content that appears in the body of an HTML cocument
    '''
    data = data.replace("&", "&amp;")  # Must be done first!
    data = data.replace("<", "&lt;")
    data = data.replace(">", "&gt;")
    if quote:
      data = data.replace('"', "&quot;")
    return data
docs: Escapes special characters into their html entities
    Replace special characters "&", "<" and ">" to HTML-safe sequences.
    If the optional flag quote is true, the quotation mark character (")
    is also translated.
  
    This is used to escape content that appears in the body of an HTML cocument