code: def create_sub_exp_from_multi_exps(
      original_stream: Iterable[DatasetExperience[TCLDataset]],
      samplers: Iterable[CyclicSampler],
      exp_per_sample_list: Iterable[torch.Tensor],
      total_iters: int,
      is_first_sub_exp: bool = False,
      is_last_sub_exp: bool = False,
  ) -> DatasetExperience[TCLDataset]:
      """
      Creates a sub-experience from a list of experiences.
  
      :param original_stream: The original stream.
      :param samplers: A list of samplers, one for each experience in the
              original stream.
      :param exp_per_sample_list: A list of experience ids, one for each sample
              in the sub-experience.
      :param total_iters: The total number of iterations.
      :param is_first_sub_exp: Whether this is the first sub-experience.
      :param is_last_sub_exp: Whether this is the last sub-experience.
  
      :return: A sub-experience.
      """
  
      # Create sub-sets from each experience's dataset
      all_subsets = []
      n_samples_from_each_exp = [0 for _ in range(len(samplers))]
  
      for exp_id in exp_per_sample_list.unique():
          n_samples = sum(exp_per_sample_list == exp_id.item()).item()
          n_samples_from_each_exp[exp_id.item()] += n_samples
          rnd_indices = [
              next(samplers[exp_id]) for _ in range(n_samples)
          ]
          subset_i = original_stream[exp_id.item()].dataset.subset(
              rnd_indices
          )
          all_subsets.append(subset_i)
  
      # Concatenate all sub-sets
      sub_exp_subset = concat_datasets(all_subsets)
  
      exp = OnlineCLExperience(
          dataset=sub_exp_subset,
          origin_experience=None,  # experience,
          is_first_subexp=is_first_sub_exp,
          is_last_subexp=is_last_sub_exp,
          sub_stream_length=total_iters,
          access_task_boundaries=False,
      )
  
      # For visualization purposes only
      exp.n_samples_from_each_exp = n_samples_from_each_exp
  
      return exp
  
imports: from functools import partial
  import random
  from typing import Callable, Generator, Generic, Iterable, List, Optional, TypeVar, Union, Protocol
  from typing_extensions import Literal
  import warnings
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.utils import concat_datasets
  import torch
  from torch.distributions.categorical import Categorical
  from torch.utils.data import Sampler
  from .deprecated.benchmark_wrapper_utils import wrap_stream
  from .generic_scenario import CLStream, CLScenario
  from .dataset_scenario import DatasetExperience
label_desc: Use image node_id 4 for calling a global function with example usage: create_sub_exp_from_multi_exps(original_stream, samplers, exp_per_sample_list, total_iters, is_first_sub_exp, is_last_sub_exp) and returns: exp