code: def _make_data_loader_with_batched_sampler(
      dataset: Dataset,
      batch_sampler: Any,
      data_loader_args: Dict[str, Any],
  ):
      data_loader_args = data_loader_args.copy()
  
      # See documentation of batch_sampler:
      # https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader
      # In fact, "generator" could be dropped too
      data_loader_args.pop("batch_size", False)
      data_loader_args.pop("shuffle", False)
      data_loader_args.pop("sampler", False)
      data_loader_args.pop("drop_last", False)
  
      data_loader_args.pop("ffcv_args", None)
  
      return DataLoader(
          dataset, batch_sampler=batch_sampler, **data_loader_args
      )
  
imports: from typing import Any, Dict, Iterator, List, Optional, Sequence, Sized, Union
  import numpy
  from torch.utils.data import DistributedSampler, Dataset
  from torch.utils.data.dataloader import DataLoader
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.data_attribute import DataAttribute
  from avalanche.benchmarks.utils.ffcv_support.ffcv_components import HybridFfcvLoader, has_ffcv_support
  from avalanche.distributed.distributed_helper import DistributedHelper
  from torch.utils.data.sampler import Sampler, BatchSampler
  from torch.utils.data import ConcatDataset
label_desc: Use image node_id 4 for calling a global function with example usage: _make_data_loader_with_batched_sampler(dataset, batch_sampler, data_loader_args) and returns: DataLoader