def _convert_to_hashable(data, types=True):
<EOL>if data is None:<EOL><INDENT>hashable = b'<STR_LIT>'<EOL>prefix = b'<STR_LIT>'<EOL><DEDENT>elif isinstance(data, six.binary_type):<EOL><INDENT>hashable = data<EOL>prefix = b'<STR_LIT>'<EOL><DEDENT>elif isinstance(data, six.text_type):<EOL><INDENT>hashable = data.encode('<STR_LIT:utf-8>')<EOL>prefix = b'<STR_LIT>'<EOL><DEDENT>elif isinstance(data, _intlike):<EOL><INDENT>hashable = _int_to_bytes(data)<EOL>prefix = b'<STR_LIT>'<EOL><DEDENT>elif isinstance(data, float):<EOL><INDENT>a, b = float(data).as_integer_ratio()<EOL>hashable = _int_to_bytes(a) + b'<STR_LIT:/>' +  _int_to_bytes(b)<EOL>prefix = b'<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>hash_func = _HASHABLE_EXTENSIONS.lookup(data)<EOL>prefix, hashable = hash_func(data)<EOL><DEDENT>if types:<EOL><INDENT>return prefix, hashable<EOL><DEDENT>else:<EOL><INDENT>return b'<STR_LIT>', hashable<EOL><DEDENT>
r"""
    Converts `data` into a hashable byte representation if an appropriate
    hashing function is known.

    Args:
        data (object): ordered data with structure
        types (bool): include type prefixes in the hash

    Returns:
        tuple(bytes, bytes): prefix, hashable:
            a prefix hinting the original data type and the byte representation
            of `data`.

    Raises:
        TypeError : if data has no registered hash methods

    Example:
        >>> assert _convert_to_hashable(None) == (b'NULL', b'NONE')
        >>> assert _convert_to_hashable('string') == (b'TXT', b'string')
        >>> assert _convert_to_hashable(1) == (b'INT', b'\x01')
        >>> assert _convert_to_hashable(1.0) == (b'FLT', b'\x01/\x01')
        >>> assert _convert_to_hashable(_intlike[-1](1)) == (b'INT', b'\x01')