def consume_payload(rlp, prefix, start, type_, length):
if type_ is bytes:<EOL><INDENT>item = rlp[start: start + length]<EOL>return (item, [prefix + item], start + length)<EOL><DEDENT>elif type_ is list:<EOL><INDENT>items = []<EOL>per_item_rlp = []<EOL>list_rlp = prefix<EOL>next_item_start = start<EOL>end = next_item_start + length<EOL>while next_item_start < end:<EOL><INDENT>p, t, l, s = consume_length_prefix(rlp, next_item_start)<EOL>item, item_rlp, next_item_start = consume_payload(rlp, p, s, t, l)<EOL>per_item_rlp.append(item_rlp)<EOL>list_rlp += item_rlp[<NUM_LIT:0>]<EOL>items.append(item)<EOL><DEDENT>per_item_rlp.insert(<NUM_LIT:0>, list_rlp)<EOL>if next_item_start > end:<EOL><INDENT>raise DecodingError('<STR_LIT>'<EOL>'<STR_LIT>', rlp)<EOL><DEDENT>return (items, per_item_rlp, next_item_start)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>
Read the payload of an item from an RLP string.

    :param rlp: the rlp string to read from
    :param type_: the type of the payload (``bytes`` or ``list``)
    :param start: the position at which to start reading
    :param length: the length of the payload in bytes
    :returns: a tuple ``(item, per_item_rlp, end)``, where ``item`` is
              the read item, per_item_rlp is a list containing the RLP
              encoding of each item and ``end`` is the position of the
              first unprocessed byte