code: def _format_search_space(
      parent_key: ParameterKey, space: SearchSpace
  ) -> list[ParameterSpec]:
      formatted: list[ParameterSpec] = []
      for name, spec in space.items():
          if name == "_name":
              continue
          key = tuple([*parent_key, name])
          formatted.append(
              _format_parameter(key, spec["_type"], spec["_value"])
          )
          if spec["_type"] == "choice" and _is_nested_choices(
              spec["_value"]
          ):
              for index, sub_space in enumerate(spec["_value"]):
                  key = tuple([*parent_key, name, index])
                  formatted += _format_search_space(key, sub_space)
      return formatted
  
file_path: nni/nni/common/hpo_utils/formatting.py
imports: from __future__ import annotations
  import math
  from types import SimpleNamespace
  from typing import Any, Dict, NamedTuple, Tuple, cast
  import numpy
  from nni.typehint import Parameters, SearchSpace
label_desc: Use image node_id 4 for calling a global function with example usage: _format_search_space(parent_key, space) and returns: formatted