import lz4.block from multiprocessing.pool import ThreadPool import sys from functools import partial if sys.version_info <= (3, 2): import struct def get_stored_size(buff): if sys.version_info > (2, 7): if isinstance(buff, memoryview): b = buff.tobytes() else: b = bytes(buff) else: b = bytes(buff) if len(b) < 4: return None if sys.version_info > (3, 2): return int.from_bytes(b[:4], 'little') else: # This would not work on a memoryview object, hence buff.tobytes call # above return struct.unpack('