code: def merge_cfg(self, args, cfg):
      env_cfg = cfg["ENV"]
      model_cfg = cfg["PipeLine"]
  
      def merge(cfg, arg):
          merge_cfg = copy.deepcopy(cfg)
          for k, v in cfg.items():
              if k in arg:
                  merge_cfg[k] = arg[k]
              else:
                  if isinstance(v, dict):
                      merge_cfg[k] = merge(v, arg)
          return merge_cfg
  
      def merge_opt(cfg, arg):
          for k, v in arg.items():
              if isinstance(cfg, Sequence):
                  k = eval(k)
                  cfg[k] = merge_opt(cfg[k], v)
              else:
                  if (
                      k in cfg
                      and (
                          isinstance(cfg[k], Sequence)
                          or isinstance(cfg[k], Mapping)
                      )
                      and isinstance(arg[k], Mapping)
                  ):
                      merge_opt(cfg[k], arg[k])
                  else:
                      cfg[k] = arg[k]
          return cfg
  
      args_dict = vars(args)
      for k, v in args_dict.items():
          if k not in env_cfg:
              env_cfg[k] = v
      env_cfg = merge(env_cfg, args_dict)
      print("env_cfg: ", env_cfg)
      if "opt" in args_dict.keys() and args_dict["opt"]:
          opt_dict = args_dict["opt"]
          if opt_dict.get("ENV", None):
              env_cfg = merge_opt(env_cfg, opt_dict["ENV"])
          if opt_dict.get("PipeLine", None):
              model_cfg = merge_opt(model_cfg, opt_dict["PipeLine"])
  
      return model_cfg, env_cfg
  
file_path: PaddleSeg/contrib/QualityInspector/qinspector/cvlib/configs.py
imports: import copy
  from argparse import ArgumentParser, RawDescriptionHelpFormatter
  from collections.abc import Mapping, Sequence
  import yaml
  from qinspector.utils.logger import setup_logger
label_desc: Use image node_id 2 for calling the ConfigParser obj's underlying member method code with example usage: obj.merge_cfg(args, cfg) and returns: model_cfg,  env_cfg, merge_cfg, cfg