def length_prefix(length, offset):
if length < <NUM_LIT>:<EOL><INDENT>return ALL_BYTES[offset + length]<EOL><DEDENT>elif length < LONG_LENGTH:<EOL><INDENT>length_string = int_to_big_endian(length)<EOL>return ALL_BYTES[offset + <NUM_LIT> - <NUM_LIT:1> + len(length_string)] + length_string<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>
Construct the prefix to lists or strings denoting their length.

    :param length: the length of the item in bytes
    :param offset: ``0x80`` when encoding raw bytes, ``0xc0`` when encoding a
                   list