code: def _decorate_generic(obj, exp_decorator):
      """Call `exp_decorator` on each experience in `obj`.
  
      `obj` can be a scenario, stream, or a single experience.
  
      `exp_decorator` is a decorator method that adds the desired attributes.
  
      streams must be eager! internal use only.
      `exp_decorator` will receive a copy of the experience.
      """
  
      # TODO: respect stream generators. Should return a new generators which applies
      #  foo_decorate_exp every time a new experience is generated.
      # IMPLEMENTATION NOTE: first, we check the type of `obj`. Then, for
      # benchmarks and streams we call `exp_decorator` on each experience.
      def _decorate_exp(obj, exp_decorator):
          return exp_decorator(copy(obj))
  
      def _decorate_benchmark(obj, exp_decorator):
          new_streams = []
          for s in obj.streams.values():
              new_streams.append(_decorate_stream(s, exp_decorator))
          return CLScenario(new_streams)
  
      def _decorate_stream(obj, exp_decorator):
          new_stream = []
          if not isinstance(obj, EagerCLStream):
              warnings.warn(
                  "stream generators will be converted to a list."
              )
          for exp in obj:
              new_stream.append(_decorate_exp(exp, exp_decorator))
          return EagerCLStream(obj.name, new_stream)
  
      if isinstance(obj, CLScenario):
          return _decorate_benchmark(obj, exp_decorator)
      elif isinstance(obj, CLStream):
          return _decorate_stream(obj, exp_decorator)
      elif isinstance(obj, CLExperience):
          return _decorate_exp(obj, exp_decorator)
      else:
          raise ValueError(
              "Unsupported object type: must be one of {CLScenario, CLStream, CLExperience}"
          )
  
file_path: avalanche/avalanche/benchmarks/scenarios/task_aware.py
imports: import warnings
  from copy import copy
  from typing import Protocol, List, Sequence
  from .generic_scenario import CLScenario, CLStream, EagerCLStream, CLExperience
  from .dataset_scenario import DatasetExperience
  from ..utils import AvalancheDataset, TaskLabels, ConstantSequence
  from ..utils.data_attribute import has_task_labels
label_desc: Use image node_id 1 for calling a global function with example usage: _decorate_generic(obj, exp_decorator) and returns: exp_decorator, CLScenario, EagerCLStream, _decorate_benchmark, _decorate_stream, _decorate_exp