(buf, byte_len)
return data, size + byte_len
Unpack data from buffer of specific length.

    :param buf: Buffer to operate on
    :type buf: bytes
    :param byte_len: Length to process
    :type byte_len: int
    :returns: bytes, int
Unpack data from buffer of specific length.
Unpack data from buffer of specific length .
def parse_variable_array(buf, byte_len):
    """Unpack data from buffer of specific length.

    :param buf: Buffer to operate on
    :type buf: bytes
    :param byte_len: Length to process
    :type byte_len: int
    :returns: bytes, int
    """
    _SIZE_FORMATS = ['!B', '!H', '!I', '!I']
    assert byte_len <= 4
    size_format = _SIZE_FORMATS[byte_len - 1]
    padding = b'\x00' if byte_len == 3 else b''
    size = struct.unpack(size_format, padding + buf[:byte_len])[0]
    data = buf[byte_len:byte_len + size]

    return data, size + byte_len
def parse_variable_array ( buf , byte_len ) : _SIZE_FORMATS = [ '!B' , '!H' , '!I' , '!I' ] assert byte_len <= 4 size_format = _SIZE_FORMATS [ byte_len - 1 ] padding = b'\x00' if byte_len == 3 else b'' size = struct . unpack ( size_format , padding + buf [ : byte_len ] ) [ 0 ] data = buf [ byte_len : byte_len + size ] return data , size + byte_len