code: def _add_index(in_x, parameter):
      """
      change parameters in NNI format to parameters in hyperopt format(This function also support nested dict.).
      For example, receive parameters like:
          {'dropout_rate': 0.8, 'conv_size': 3, 'hidden_size': 512}
      Will change to format in hyperopt, like:
          {'dropout_rate': 0.8, 'conv_size': {'_index': 1, '_value': 3}, 'hidden_size': {'_index': 1, '_value': 512}}
      """
      if NodeType.TYPE not in in_x:  # if at the top level
          out_y = dict()
          for key, value in parameter.items():
              out_y[key] = _add_index(in_x[key], value)
          return out_y
      elif isinstance(in_x, dict):
          value_type = in_x[NodeType.TYPE]
          value_format = in_x[NodeType.VALUE]
          if value_type == "choice":
              choice_name = (
                  parameter[0]
                  if isinstance(parameter, list)
                  else parameter
              )
              for pos, item in enumerate(
                  value_format
              ):  # here value_format is a list
                  if isinstance(
                      item, list
                  ):  # this format is ["choice_key", format_dict]
                      choice_key = item[0]
                      choice_value_format = item[1]
                      if choice_key == choice_name:
                          return {
                              NodeType.INDEX: pos,
                              NodeType.VALUE: [
                                  choice_name,
                                  _add_index(
                                      choice_value_format, parameter[1]
                                  ),
                              ],
                          }
                  elif choice_name == item:
                      return {NodeType.INDEX: pos, NodeType.VALUE: item}
          else:
              return parameter
      return None
  
imports: import copy
  import logging
  import hyperopt
  import numpy
  from schema import Optional, Schema
  from nni import ClassArgsValidator
  from nni.common.hpo_utils import validate_search_space
  from nni.tuner import Tuner
  from nni.utils import NodeType, OptimizeMode, extract_scalar_reward, split_index
label_desc: Use image node_id 4 for calling a global function with example usage: _add_index(in_x, parameter) and returns: None, out_y, parameter, dict, dict