def asciihex(stream, columns = None):
    """ASCIIHex encoder augmented with a beautifier (colums and newlines) for DEBUG ONLY."""
    if columns is None:
        return (binascii.hexlify(stream)).upper()
    else:
        res = b''
        i = 0
        l = sum(columns)
        while i+l <= len(stream):
            for c in columns:
                res += (binascii.hexlify(stream[i:i+c])).upper() 
                res += b' '
                i += c
            res += b'\n'
        return res
ASCIIHex encoder augmented with a beautifier (colums and newlines) for DEBUG ONLY.
pdfsyntax/filters.py