code: def get_test_pipeline_cfg(cfg: Union[str, ConfigDict]) -> ConfigDict:
      """Get the test dataset pipeline from entire config.
  
      Args:
          cfg (str or :obj:`ConfigDict`): the entire config. Can be a config
              file or a ``ConfigDict``.
  
      Returns:
          :obj:`ConfigDict`: the config of test dataset.
      """
      if isinstance(cfg, str):
          cfg = Config.fromfile(cfg)
  
      def _get_test_pipeline_cfg(dataset_cfg):
          if "pipeline" in dataset_cfg:
              return dataset_cfg.pipeline
          # handle dataset wrapper
          elif "dataset" in dataset_cfg:
              return _get_test_pipeline_cfg(dataset_cfg.dataset)
          # handle dataset wrappers like ConcatDataset
          elif "datasets" in dataset_cfg:
              return _get_test_pipeline_cfg(dataset_cfg.datasets[0])
  
          raise RuntimeError(
              "Cannot find `pipeline` in `test_dataloader`"
          )
  
      return _get_test_pipeline_cfg(cfg.test_dataloader.dataset)
  
file_path: mmdetection/mmdet/utils/misc.py
imports: import glob
  import os
  import os.path
  import urllib
  import warnings
  from typing import Union
  import torch
  from mmengine.config import Config, ConfigDict
  from mmengine.logging import print_log
  from mmengine.utils import scandir
label_desc: Use image node_id 3 for calling a global function with example usage: get_test_pipeline_cfg(cfg) and returns: _get_test_pipeline_cfg, dataset_cfg, _get_test_pipeline_cfg, _get_test_pipeline_cfg