def decode_lazy(rlp, sedes: nil, sedes_options: {})
      item, next_start = consume_item_lazy(rlp, 0)

      raise DecodingError.new("RLP length prefix announced wrong length", rlp) if next_start != rlp.size

      if item.instance_of?(LazyList)
        item.sedes = sedes
        item.sedes_options = sedes_options
        item
      elsif sedes
        # FIXME: lazy man's kwargs
        sedes_options.empty? ?
          sedes.deserialize(item) :
          sedes.deserialize(item, **sedes_options)
      else
        item
      end
    end
def decode_lazy(rlp, sedes: nil, sedes_options: {})
      item, next_start = consume_item_lazy(rlp, 0)

      raise DecodingError.new("RLP length prefix announced wrong length", rlp) if next_start != rlp.size

      if item.instance_of?(LazyList)
        item.sedes = sedes
        item.sedes_options = sedes_options
        item
      elsif sedes
        # FIXME: lazy man's kwargs
        sedes_options.empty? ?
          sedes.deserialize(item) :
          sedes.deserialize(item, **sedes_options)
      else
        item
      end
    end
Decode an RLP encoded object in a lazy fashion.

 If the encoded object is a byte string, this function acts similar to
 {RLP::Decode#decode}. If it is a list however, a {LazyList} is returned
 instead. This object will decode the string lazily, avoiding both
 horizontal and vertical traversing as much as possible.

 The way `sedes` is applied depends on the decoded object: If it is a
 string `sedes` deserializes it as a whole; if it is a list, each element
 is deserialized individually. In both cases, `sedes_options` are passed
 on. Note that, if a deserializer is used, only "horizontal" but not
 "vertical lazyness" can be preserved.

 @param rlp [String] the RLP string to decode
 @param sedes [Object] an object implementing a method `deserialize(code)`
   which is used as described above, or `nil` if no deserialization should
   be performed
 @param sedes_options [Hash] additional keyword arguments that will be
   passed to the deserializers

 @return [Object] either the already decoded and deserialized object (if
   encoded as a string) or an instance of {RLP::LazyList}