parameters: (byte_string)
return_statement: return '"' + ''.join('\\x{:02x}'.format(ord(char)) for char in byte_string) + '"'
docstring: convert arbitrary byte sequence into a C++ string literal by escaping every character
docstring_summary: convert arbitrary byte sequence into a C++ string literal by escaping every character
docstring_tokens: convert arbitrary byte sequence into a C ++ string literal by escaping every character
function: def cstring_literal(byte_string):
      """convert arbitrary byte sequence into a C++ string literal by escaping every character"""
      if all(c in NOESCAPE_CHARACTERS for c in byte_string):
          return '"' + byte_string.decode() + '"'
      return '"' + ''.join('\\x{:02x}'.format(ord(char)) for char in byte_string) + '"'
function_tokens: def cstring_literal ( byte_string ) : if all ( c in NOESCAPE_CHARACTERS for c in byte_string ) : return '"' + byte_string . decode ( ) + '"' return '"' + '' . join ( '\\x{:02x}' . format ( ord ( char ) ) for char in byte_string ) + '"'