code: def load_config(p: Path) -> Dict[str, ConfigEnv]:
      p = Path(str(p)).expanduser()
      if p.suffix == ".toml":
          rv = toml.load(p)
          return rv
  
      if p.suffix != ".cfg":
          raise ValueError(
              "Config files should be either .cfg or .toml files"
          )
  
      def get_val(cfg: configparser.ConfigParser, section: str, key):
          try:
              return cfg.getint(section, key)
          except ValueError:
              pass
          try:
              return cfg.getfloat(section, key)
          except ValueError:
              pass
          try:
              return cfg.getboolean(section, key)
          except ValueError:
              pass
  
          return cfg[section][key]
  
      cfg = configparser.ConfigParser()
      cfg.optionxform = str
      cfg.read(p)
  
      rv = {}
  
      for exp_name in cfg.sections():
          exp = {}
          for key in cfg[exp_name].keys():
              exp[key] = get_val(cfg, exp_name, key)
          rv[exp_name] = exp
  
      return rv
  
file_path: transfer-nlp/transfer_nlp/runner/experiment_runner.py
imports: import configparser
  import logging
  import shutil
  from copy import deepcopy
  from pathlib import Path
  from typing import Dict, Any, Union
  import toml
  from transfer_nlp.plugins.config import ExperimentConfig
  from transfer_nlp.plugins.reporters import ReporterABC
  from transfer_nlp.plugins.trainer_abc import TrainerABC
label_desc: Use image node_id 1 for calling a global function with example usage: load_config(p) and returns: rv, rv, cfg, cfg, cfg, cfg