code: def _make_data_loader(
      dataset: Dataset,
      distributed_sampling: bool,
      data_loader_args: Dict[str, Any],
      batch_size: int,
      force_no_workers: bool = False,
  ):
      data_loader_args = data_loader_args.copy()
      data_loader_args.pop("ffcv_args", None)
  
      collate_from_data_or_kwargs(dataset, data_loader_args)
  
      if force_no_workers:
          data_loader_args["num_workers"] = 0
          if "persistent_workers" in data_loader_args:
              data_loader_args["persistent_workers"] = False
          if "prefetch_factor" in data_loader_args:
              data_loader_args["prefetch_factor"] = 2
  
      if DistributedHelper.is_distributed and distributed_sampling:
          # Note: shuffle only goes in the sampler, while
          # drop_last must be passed to both the sampler
          # and the DataLoader
          drop_last = data_loader_args.pop("drop_last", False)
          sampler = DistributedSampler(
              dataset,
              shuffle=data_loader_args.pop("shuffle", True),
              drop_last=drop_last,
          )
          data_loader = DataLoader(
              dataset,
              sampler=sampler,
              batch_size=batch_size,
              drop_last=drop_last,
              **data_loader_args,
          )
      else:
          sampler = None
          data_loader = DataLoader(
              dataset, batch_size=batch_size, **data_loader_args
          )
  
      return data_loader, sampler
  
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 3 for calling a global function with example usage: _make_data_loader(dataset, distributed_sampling, data_loader_args, batch_size, force_no_workers) and returns: data_loader,  sampler