public static Bytes encode(final Object obj) {
    final BytesValueRLPOutput out = new BytesValueRLPOutput();
    encode(obj, out);
    return out.encoded();
  }
Recursively RLP encode an object consisting of recursive lists of {@link Bytes}. Bytes are
assumed to be non-scalar (leading zeros are not trimmed).

@param obj An object that must be either directly a {@link Bytes}, or a list whose elements are
    either {@link Bytes}, or similarly composed sub-lists.
@return The RLP encoding corresponding to {@code obj}.
@throws IllegalArgumentException if {@code obj} is not a valid input (not entirely composed
    from lists and {@link Bytes}).
ethereum/rlp/src/test-support/java/org/hyperledger/besu/ethereum/rlp/util/RLPTestUtil.java