def str_to_c_string(string):
  """Converts a Python bytes to a C++ string literal.

    >>> str_to_c_string(b'abc\x8c')
    '"abc\\\\x8c"'
    """
  return repr(string).replace("'", '"').removeprefix('b')