code: def get_loader(
      dataset,
      num_samples: tp.Optional[int],
      batch_size: int,
      num_workers: int,
      seed: int,
      **kwargs,
  ) -> torch.utils.data.DataLoader:
      """Convenience function to load dataset into a dataloader with optional subset sampling.
  
      Args:
          dataset: Dataset to load.
          num_samples (Optional[int]): Number of samples to limit subset size.
          batch_size (int): Batch size.
          num_workers (int): Number of workers for data loading.
          seed (int): Random seed.
      """
      if num_samples is not None:
          dataset = random_subset(dataset, num_samples, seed)
  
      dataloader = flashy.distrib.loader(
          dataset,
          batch_size=batch_size,
          num_workers=num_workers,
          **kwargs,
      )
      return dataloader
  
imports: from concurrent.futures import ProcessPoolExecutor
  from contextlib import contextmanager
  from functools import wraps, lru_cache
  import hashlib
  import json
  import logging
  from pathlib import Path
  import typing
  import flashy
  import flashy.distrib
  import omegaconf
  import torch
  from torch.nn.utils.rnn import pad_sequence
label_desc: Use image node_id 4 for calling a global function with example usage: get_loader(dataset, num_samples, batch_size, num_workers, seed) and returns: dataloader