code: def _random_config(search_space, random_state):
      chosen_config = {}
      for key, val in search_space.items():
          if val["_type"] == "choice":
              choices = val["_value"]
              index = random_state.randint(len(choices))
              if all([isinstance(c, (int, float)) for c in choices]):
                  chosen_config[key] = choices[index]
              else:
                  raise ValueError(
                      "Choices with type other than int and float is not supported."
                  )
          elif val["_type"] == "uniform":
              chosen_config[key] = random_state.uniform(
                  val["_value"][0], val["_value"][1]
              )
          elif val["_type"] == "randint":
              chosen_config[key] = random_state.randint(
                  val["_value"][0], val["_value"][1]
              )
          elif val["_type"] == "quniform":
              chosen_config[key] = parameter_expressions.quniform(
                  val["_value"][0],
                  val["_value"][1],
                  val["_value"][2],
                  random_state,
              )
          elif val["_type"] == "loguniform":
              chosen_config[key] = parameter_expressions.loguniform(
                  val["_value"][0], val["_value"][1], random_state
              )
          elif val["_type"] == "qloguniform":
              chosen_config[key] = parameter_expressions.qloguniform(
                  val["_value"][0],
                  val["_value"][1],
                  val["_value"][2],
                  random_state,
              )
          else:
              raise ValueError(
                  "Unknown key %s and value %s" % (key, val)
              )
      return chosen_config
  
imports: import logging
  import warnings
  import numpy
  import torch
  from pybnn import DNGO
  from torch.distributions import Normal
  import nni.parameter_expressions
  from nni import ClassArgsValidator
  from nni.common.hpo_utils import validate_search_space
  from nni.tuner import Tuner
label_desc: Use image node_id 1 for calling a global function with example usage: _random_config(search_space, random_state) and returns: chosen_config