code: 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
  
imports: from typing import Generic, Iterable, Iterator, List, Optional, TypeVar
  from avalanche.benchmarks.scenarios.generic_scenario import CLExperience, CLScenario, CLStream, SequenceCLStream, SizedCLStream
label_desc: Use image node_id 1 for calling a global function with example usage: wrap_stream(new_name, new_benchmark, wrapped_stream) and returns: s_wrapped