code: def escape_char(c):
      if IS_PYTHON3:
          c = c.decode("ISO-8859-1")
      if c in "\n\r\t\\":
          return repr(c)[1:-1]
      elif c == "'":
          return "\\'"
      n = ord(c)
      if n < 32 or n > 127:
          # hex works well for characters
          return "\\x%02X" % n
      else:
          return c
  
imports: from __future__ import absolute_import
  import re
  import sys
label_desc: Use image node_id 7 for calling a global function with example usage: escape_char(c) and returns: repr, unknown, c, str