code: def _one_dataset_per_exp_class_order(
      class_list_per_exp: Sequence[Sequence[int]],
      shuffle: bool,
      seed: Optional[int],
  ) -> Tuple[List[int], Dict[int, int]]:
      """
      Utility function that shuffles the class order by keeping classes from the
      same experience together. Each experience is defined by a different entry in
      the class_list_per_exp parameter.
  
      :param class_list_per_exp: A list of class lists, one for each experience
      :param shuffle: If True, the experience order will be shuffled. If False,
          this function will return the concatenation of lists from the
          class_list_per_exp parameter.
      :param seed: If not None, an integer used to initialize the random
          number generator.
  
      :returns: A class order that keeps class IDs from the same experience
          together (adjacent).
      """
      dataset_order = list(range(len(class_list_per_exp)))
      if shuffle:
          if seed is not None:
              torch.random.manual_seed(seed)
          dataset_order = torch.as_tensor(dataset_order)[
              torch.randperm(len(dataset_order))
          ].tolist()
      fixed_class_order: List[int] = []
      classes_per_exp: Dict[int, int] = {}
      for dataset_position, dataset_idx in enumerate(dataset_order):
          fixed_class_order.extend(class_list_per_exp[dataset_idx])
          classes_per_exp[dataset_position] = len(
              class_list_per_exp[dataset_idx]
          )
      return fixed_class_order, classes_per_exp
  
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 3 for calling a global function with example usage: _one_dataset_per_exp_class_order(class_list_per_exp, shuffle, seed) and returns: fixed_class_order,  classes_per_exp