code: def _smart_benchmark_factory(
      original_benchmark: DatasetScenario,
      new_streams_definitions: TStreamsUserDict,
      complete_test_set_only: bool,
  ) -> DatasetScenario:
      if isinstance(original_benchmark, ClassificationScenario):
          return ClassificationScenario(
              stream_definitions=new_streams_definitions,
              complete_test_set_only=complete_test_set_only,
          )
      elif isinstance(original_benchmark, DetectionScenario):
          return DetectionScenario(
              stream_definitions=new_streams_definitions,
              complete_test_set_only=complete_test_set_only,
          )
      else:
          # Generic scenario
          return DatasetScenario(
              stream_definitions=new_streams_definitions,
              complete_test_set_only=complete_test_set_only,
              stream_factory=FactoryBasedStream,
              experience_factory=_make_plain_experience,
          )
  
file_path: avalanche/avalanche/benchmarks/scenarios/deprecated/generators.py
imports: from typing import TYPE_CHECKING, Sequence, Optional, Dict, TypeVar, Union, Any, List, Callable, Set, Tuple
  import torch
  from avalanche.benchmarks.scenarios.dataset_scenario import split_validation_random
  from avalanche.benchmarks.scenarios.deprecated.classification_scenario import ClassificationScenario
  from avalanche.benchmarks.scenarios.deprecated.dataset_scenario import DatasetScenario, DatasetStream, FactoryBasedStream, StreamDef, TStreamsUserDict
  from avalanche.benchmarks.scenarios.detection_scenario import DetectionScenario
  from avalanche.benchmarks.scenarios.deprecated.generic_benchmark_creation import *
  from avalanche.benchmarks.scenarios.deprecated import DatasetExperience
  from avalanche.benchmarks.scenarios.deprecated.lazy_dataset_sequence import LazyDatasetSequence
  from avalanche.benchmarks.scenarios.deprecated.new_classes.nc_scenario import NCScenario
  from avalanche.benchmarks.scenarios.deprecated.new_instances.ni_scenario import NIScenario
  from avalanche.benchmarks.scenarios.online import FixedSizeExperienceSplitter
  from avalanche.benchmarks.utils.classification_dataset import SupportedDataset, _as_taskaware_supervised_classification_dataset, _make_taskaware_classification_dataset, _concat_taskaware_classification_datasets_sequentially
label_desc: Use image node_id 5 for calling a global function with example usage: _smart_benchmark_factory(original_benchmark, new_streams_definitions, complete_test_set_only) and returns: ClassificationScenario, DetectionScenario, DatasetScenario