def wrap_stream(
    new_name: str, new_benchmark: CLScenario, wrapped_stream: CLStream
) -> CLStream:
    """
    Internal utility used to wrap a stream by keeping
    as most functionality as possible.

    :param new_name: The name of the new stream.
    :param new_benchmark: The new benchmark.
    :param wrapped_stream: The stream to be wrapped.
    """
    s_wrapped: CLStream
    if isinstance(wrapped_stream, SequenceCLStream):
        # Maintain indexing/slicing functionalities
        s_wrapped = SequenceStreamWrapper(
            name=new_name, benchmark=new_benchmark, wrapped_stream=wrapped_stream
        )
    elif isinstance(wrapped_stream, SizedCLStream):
        # Sized stream
        s_wrapped = SizedCLStreamWrapper(
            name=new_name, benchmark=new_benchmark, wrapped_stream=wrapped_stream
        )
    else:
        # Plain iter-based stream
        s_wrapped = CLStreamWrapper(
            name=new_name, benchmark=new_benchmark, wrapped_stream=wrapped_stream
        )
    return s_wrapped

    Internal utility used to wrap a stream by keeping
    as most functionality as possible.

    :param new_name: The name of the new stream.
    :param new_benchmark: The new benchmark.
    :param wrapped_stream: The stream to be wrapped.
    
avalanche/benchmarks/scenarios/deprecated/benchmark_wrapper_utils.py