code: def htmlescape(s, quote=True):
      # this is html.escape reimplemented with cgi.escape,
      # so it works for python 2.x, 3.0 and 3.1
      import cgi
  
      s = cgi.escape(s, quote)
      if quote:
          # python 3.2 also replaces the single quotes:
          s = s.replace("'", "&#x27;")
      return s
  
label_desc: Use image node_id 1 for calling a global function with example usage: htmlescape(s, quote) and returns: s