code: def translate_escaped_str(cls, str_val):
          
          if isinstance(str_val, string_types):
              str_val = str_val.encode('unicode_escape')
              if sys.version_info >= (3, 0):
                  str_val = str_val.decode('utf-8')
              str_val = str_val.replace('"', r'\"')
          return '"{}"'.format(str_val)
docs: Reusable by most interpreters