def _reencode_string(string):
    """Ensure that the string is encodable into JSON."""
    if isinstance(string, bytes):
        return string.decode('utf-8', errors='__sqreen_ascii_to_hex')
    return string
