code: def get_train_eval_loader(
      dataset,
      envs,
      batch_size,
      class_balanced,
      holdout_fraction,
      trial_seed,
  ):
      """Return training and validation dataloaders.
  
      :param dataset: dataset class containing list of environments
      :param envs: list containing indices of training domains in the dataset
      :param batch_size: Value of batch size to be used for dataloaders
      :param class_balanced: Binary flag indicating whether balanced sampling is to be done between classes
      :param holdout_fraction: fraction of training data used for creating validation domains
      :param trial_seed: seed used for generating validation split from training data
  
      :returns: two lists of dataloaders for training (train_loaders) and validation (val_loaders) respectively
      """
      train_splits, val_splits = [], []
  
      for env_idx, env in enumerate(dataset):
          if env_idx in envs:
              val_, train_ = misc.split_dataset(
                  env,
                  int(len(env) * holdout_fraction),
                  misc.seed_hash(trial_seed, env_idx),
              )
  
              if class_balanced:
                  train_weights = (
                      misc.make_weights_for_balanced_classes(train_)
                  )
                  val_weights = misc.make_weights_for_balanced_classes(
                      val_
                  )
              else:
                  train_weights, val_weights = None, None
  
              train_splits.append((train_, train_weights))
              val_splits.append((val_, val_weights))
  
      train_loaders = [
          InfiniteDataLoader(
              dataset=env,
              weights=env_weights,
              batch_size=batch_size,
              num_workers=dataset.N_WORKERS,
          )
          for env, env_weights in train_splits
      ]
  
      eval_loaders = [
          FastDataLoader(
              dataset=env,
              batch_size=batch_size,
              num_workers=dataset.N_WORKERS,
          )
          for env, _ in val_splits
      ]
  
      return train_loaders, eval_loaders
  
imports: from dowhy.causal_prediction.dataloaders import misc
  from dowhy.causal_prediction.dataloaders.fast_data_loader import FastDataLoader, InfiniteDataLoader
label_desc: Use image node_id 3 for calling a global function with example usage: get_train_eval_loader(dataset, envs, batch_size, class_balanced, holdout_fraction, trial_seed) and returns: train_loaders,  eval_loaders