code: def load_sampler(param, sampler):
      """Loads and validates a sampler against one of the SAMPLERS templates."""
      sampler_type = sampler.TYPE.upper() if "TYPE" in sampler else None
      err_msg = "Sampler for '{}' has an unknown or missing TYPE:\n{}"
      assert sampler_type in SAMPLERS, err_msg.format(param, sampler)
      full_sampler = SAMPLERS[sampler_type].clone()
      full_sampler.merge_from_other_cfg(sampler)
      validate_sampler(param, full_sampler)
      if sampler_type == "LIST_SAMPLER":
          full_sampler.ITEM_SAMPLER = load_sampler(
              param, sampler.ITEM_SAMPLER
          )
      return full_sampler
  
file_path: pycls/pycls/sweep/config.py
imports: import argparse
  import getpass
  import multiprocessing
  import os
  import sys
  from pycls.core.config import cfg
  from pycls.sweep.samplers import validate_sampler
  from yacs.config import CfgNode
label_desc: Use image node_id 2 for calling a global function with example usage: load_sampler(param, sampler) and returns: full_sampler