def unpack(data, bitlen):
    mask = (1 << bitlen) - 1
for chunk in zip(*([iter(data)] * bitlen)):
    n = int.from_bytes(chunk, 'big')
a = []
for i in range(8):
    pass
Casting a bytearray containing 11-bit integers to an array of 16-bit integers