code: def _inverse_cluster_metadata(
      platform: str, metadata_config: list
  ) -> dict:
      inverse_config = {}
      if platform == "local":
          inverse_config["trial"] = {}
          for kv in metadata_config:
              if kv["key"] == "local_config":
                  inverse_config["localConfig"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      elif platform == "remote":
          for kv in metadata_config:
              if kv["key"] == "machine_list":
                  inverse_config["machineList"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
              elif kv["key"] == "remote_config":
                  inverse_config["remoteConfig"] = kv["value"]
      elif platform == "pai":
          for kv in metadata_config:
              if kv["key"] == "pai_config":
                  inverse_config["paiConfig"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      elif platform == "kubeflow":
          for kv in metadata_config:
              if kv["key"] == "kubeflow_config":
                  inverse_config["kubeflowConfig"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      elif platform == "frameworkcontroller":
          for kv in metadata_config:
              if kv["key"] == "frameworkcontroller_config":
                  inverse_config["frameworkcontrollerConfig"] = kv[
                      "value"
                  ]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      elif platform == "aml":
          for kv in metadata_config:
              if kv["key"] == "aml_config":
                  inverse_config["amlConfig"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      elif platform == "dlc":
          for kv in metadata_config:
              if kv["key"] == "dlc_config":
                  inverse_config["dlcConfig"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      elif platform == "adl":
          for kv in metadata_config:
              if kv["key"] == "adl_config":
                  inverse_config["adlConfig"] = kv["value"]
              elif kv["key"] == "trial_config":
                  inverse_config["trial"] = kv["value"]
      else:
          raise RuntimeError(
              "training service platform {} not found".format(platform)
          )
      return inverse_config
  
file_path: nni/nni/tools/nnictl/config_utils.py
imports: import os
  import sqlite3
  import nni
  from .constants import NNI_HOME_DIR
  from .common_utils import get_file_lock
label_desc: Use image node_id 2 for calling a global function with example usage: _inverse_cluster_metadata(platform, metadata_config) and returns: inverse_config