code: def _select_data_fetcher(
      trainer: "pl.Trainer", stage: RunningStage
  ) -> _DataFetcher:
      lightning_module = trainer.lightning_module
      if stage == RunningStage.TESTING:
          step_fx_name = "test_step"
      elif stage == RunningStage.TRAINING:
          step_fx_name = "training_step"
      elif stage in (
          RunningStage.VALIDATING,
          RunningStage.SANITY_CHECKING,
      ):
          step_fx_name = "validation_step"
      elif stage == RunningStage.PREDICTING:
          step_fx_name = "predict_step"
      else:
          raise RuntimeError(
              f"DataFetcher is unsupported for {trainer.state.stage}"
          )
      step_fx = getattr(lightning_module, step_fx_name)
      if is_param_in_hook_signature(
          step_fx, "dataloader_iter", explicit=True
      ):
          rank_zero_warn(
              f"Found `dataloader_iter` argument in the `{step_fx_name}`. Note that the support for "
              "this signature is experimental and the behavior is subject to change."
          )
          return _DataLoaderIterDataFetcher()
      return _PrefetchDataFetcher()
  
imports: import inspect
  from contextlib import contextmanager
  from typing import Any, Callable, ContextManager, Generator, Optional, Tuple, Type
  import torch
  import torch.distributed
  from torch import Tensor
  import lightning.pytorch
  from lightning.fabric.utilities.distributed import _distributed_is_initialized
  from lightning.fabric.utilities.imports import _TORCH_EQUAL_2_0, _TORCH_GREATER_EQUAL_1_13
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch.accelerators.xla import XLAAccelerator
  from lightning.pytorch.callbacks.timer import Timer
  from lightning.pytorch.loops import _Loop
  from lightning.pytorch.loops.fetchers import _DataFetcher, _DataLoaderIterDataFetcher, _PrefetchDataFetcher
  from lightning.pytorch.loops.progress import _BaseProgress
  from lightning.pytorch.strategies import FSDPStrategy
  from lightning.pytorch.strategies.parallel import ParallelStrategy
  from lightning.pytorch.strategies.strategy import Strategy
  from lightning.pytorch.trainer.states import RunningStage
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
  from lightning.pytorch.utilities.signature_utils import is_param_in_hook_signature
label_desc: Use image node_id 6 for calling a global function with example usage: _select_data_fetcher(trainer, stage) and returns: _PrefetchDataFetcher, _DataLoaderIterDataFetcher