code: def json2parameter(ss_spec, random_state):
      """Randomly generate values for hyperparameters from hyperparameter space i.e., x.
  
      Parameters
      ----------
      ss_spec:
          hyperparameter space
      random_state:
          random operator to generate random values
  
      Returns
      -------
      Parameter:
          Parameters in this experiment
      """
      if isinstance(ss_spec, dict):
          if NodeType.TYPE in ss_spec.keys():
              _type = ss_spec[NodeType.TYPE]
              _value = ss_spec[NodeType.VALUE]
              if _type == "choice":
                  _index = random_state.randint(len(_value))
                  chosen_params = json2parameter(
                      ss_spec[NodeType.VALUE][_index], random_state
                  )
              else:
                  chosen_params = getattr(parameter_expressions, _type)(
                      *(_value + [random_state])
                  )
          else:
              chosen_params = dict()
              for key in ss_spec.keys():
                  chosen_params[key] = json2parameter(
                      ss_spec[key], random_state
                  )
      elif isinstance(ss_spec, list):
          chosen_params = list()
          for _, subspec in enumerate(ss_spec):
              chosen_params.append(
                  json2parameter(subspec, random_state)
              )
      else:
          chosen_params = copy.deepcopy(ss_spec)
      return chosen_params
  
imports: import copy
  import logging
  import math
  import sys
  import numpy
  from schema import Schema, Optional
  import nni
  from nni import ClassArgsValidator
  from nni.common.hpo_utils import validate_search_space
  from nni.runtime.common import multi_phase_enabled
  from nni.runtime.msg_dispatcher_base import MsgDispatcherBase
  from nni.runtime.tuner_command_channel import CommandType
  from nni.utils import NodeType, OptimizeMode, MetricType, extract_scalar_reward
  from nni import parameter_expressions
label_desc: Use image node_id 3 for calling a global function with example usage: json2parameter(ss_spec, random_state) and returns: chosen_params