def pp_hex(raw, reverse=True):
    """Return a pretty-printed (hex style) version of a binary string.

    Args:
        raw (bytes): any sequence of bytes
        reverse (bool): True if output should be in reverse order.

    Returns:
        Hex string corresponding to input byte sequence.
    """
    if not reverse:
        return ''.join(['{:02x}'.format(v) for v in bytearray(raw)])
    return ''.join(reversed(['{:02x}'.format(v) for v in bytearray(raw)]))