def PrefixedArray(subcon, length_field = UBInt8("length")):
    """an array prefixed by a length field.
    * subcon - the subcon to be repeated
    * length_field - a construct returning an integer
    """
    return LengthValueAdapter(
        Sequence(subcon.name,
            length_field,
            Array(lambda ctx: ctx[length_field.name], subcon),
            nested = False
        )
    )
an array prefixed by a length field.
    * subcon - the subcon to be repeated
    * length_field - a construct returning an integer
    
product/runtime/src/main/python/java/_vendor/elftools/construct/macros.py