code: def sample_config(args, config):
      """
      Sample a set of hyperparams from given config.
  
      :param args: The arguments with possbile search space params.
      :param config: a combinition of hyperparams (e.g. obtained in each trial)
      :return: a sampled set of hyperparams.
      """
      args = copy.deepcopy(args)
      striped_keys = [k.split(SPLITTER)[0] for k in config.keys()]
      if isinstance(
          args, (argparse.Namespace, argparse.ArgumentParser)
      ):
          args_dict = vars(args)
      else:
          args_dict = args
      for k, v in args_dict.items():
          # handle different type of configurations
          if k in striped_keys:
              if isinstance(v, NestedSpace):
                  sub_config = _strip_config_space(config, prefix=k)
                  args_dict[k] = v.sample(**sub_config)
              else:
                  if SPLITTER in k:
                      continue
                  args_dict[k] = config[k]
          elif isinstance(v, AutoObject):
              args_dict[k] = v.init()
      return args
  
imports: import copy
  import logging
  import argparse
  import functools
  from collections import OrderedDict
  import numpy
  import multiprocessing
  from .space import *
  from .space import _add_hp, _add_cs, _rm_hp, _strip_config_space, SPLITTER
  from .callgraph import CallCache
  from bigdl.nano.automl.utils import EasyDict
  from bigdl.nano.automl.utils import proxy_methods
  from bigdl.nano.automl.hpo.backend import create_hpo_backend
  from bigdl.nano.deps.automl.hpo_api import create_configuration_space
label_desc: Use image node_id 1 for calling a global function with example usage: sample_config(args, config) and returns: args