code: def _to_escape_sequence(s):
      if s in "\n\r\t":
          return repr(s)[1:-1]
      elif s == '"':
          return r"\""
      elif s == "\\":
          return r"\\"
      else:
          # within a character sequence, oct passes much better than hex
          return "".join(["\\%03o" % ord(c) for c in s])
  
imports: from __future__ import absolute_import
  import re
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: _to_escape_sequence(s) and returns: repr, str, str, str