import struct def get_two_bytes_from_buffer(buffer, offset=0): if isinstance(buffer, list): buffer = bytearray(buffer) return struct.unpack_from('