# Path: resources/lib/kindleunpack/compatibility_utils.py
# PY2 = sys.version_info[0] == 2
# 
# def hexlify(bdata):
#     return (binascii.hexlify(bdata)).decode('ascii')
# 
# def bstr(s):
#     if isinstance(s, str):
#         return bytes(s, 'latin-1')
#     else:
#         return bytes(s)
# 
# def bord(s):
#     return s
# 
# def bchar(s):
#     return bytes([s])
# 
# Path: resources/lib/kindleunpack/unipath.py
# def pathof(s, enc=fsencoding):
#     if s is None:
#         return None
#     if isinstance(s, text_type):
#         return s
#     if isinstance(s, binary_type):
#         try:
#             return s.decode(enc)
#         except:
#             pass
#     return s


from .compatibility_utils import PY2, hexlify, bstr, bord, bchar
from .unipath import pathof
import datetime
import struct
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab

from __future__ import unicode_literals, division, absolute_import, print_function



if PY2:
    range = xrange

# note:  struct pack, unpack, unpack_from all require bytestring format
# data all the way up to at least python 2.7.5, python 3 okay with bytestring


DUMP = False
""" Set to True to dump all possible information. """

class unpackException(Exception):
    pass


def describe(data):
    txtans = ''
    hexans = hexlify(data)
    for i in data:

# Path: resources/lib/kindleunpack/compatibility_utils.py
# PY2 = sys.version_info[0] == 2
# 
# def hexlify(bdata):
#     return (binascii.hexlify(bdata)).decode('ascii')
# 
# def bstr(s):
#     if isinstance(s, str):
#         return bytes(s, 'latin-1')
#     else:
#         return bytes(s)
# 
# def bord(s):
#     return s
# 
# def bchar(s):
#     return bytes([s])
# 
# Path: resources/lib/kindleunpack/unipath.py
# def pathof(s, enc=fsencoding):
#     if s is None:
#         return None
#     if isinstance(s, text_type):
#         return s
#     if isinstance(s, binary_type):
#         try:
#             return s.decode(enc)
#         except:
#             pass
#     return s


# Path: resources/lib/kindleunpack/mobi_sectioner.py
from .compatibility_utils import PY2, hexlify, bstr, bord, bchar
from .unipath import pathof
import datetime
import struct

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab

from __future__ import unicode_literals, division, absolute_import, print_function



if PY2:
    range = xrange

# note:  struct pack, unpack, unpack_from all require bytestring format
# data all the way up to at least python 2.7.5, python 3 okay with bytestring


DUMP = False
""" Set to True to dump all possible information. """

class unpackException(Exception):
    pass


def describe(data):
    txtans = ''
    hexans = hexlify(data)
    for i in data:

        if bord(i) < 32 or bord(i) > 127: