code: def original_format_to_exchange_format(original_format, version_info):
      """
      Change config original format to exchange format.
      """
      exchange_format = {}
      exchange_format["ensembles"] = []
      exchange_format["models"] = []
      # 0. transform version info into component format in frontend
      for model_name, version_filenames_dict in version_info.items():
          version_info_for_frontend = []
          for version_name, filenames in version_filenames_dict.items():
              version_filenames_dict_for_frontend = {}
              version_filenames_dict_for_frontend[
                  "title"
              ] = version_name
              version_filenames_dict_for_frontend["key"] = version_name
              version_filenames_dict_for_frontend["children"] = []
              for filename in filenames:
                  version_filenames_dict_for_frontend[
                      "children"
                  ].append({"title": filename, "key": filename})
              version_info_for_frontend.append(
                  version_filenames_dict_for_frontend
              )
          version_info[model_name] = version_info_for_frontend
  
      for model_name, model_config in original_format.items():
          # 1. remove 'executionAccelerators' keyword
          transformed_config = copy.deepcopy(model_config)
          if "optimization" in model_config:
              if (
                  "executionAccelerators"
                  in model_config["optimization"]
              ):
                  transformed_optimization_config = model_config[
                      "optimization"
                  ]["executionAccelerators"]
                  del transformed_config["optimization"]
                  transformed_config[
                      "optimization"
                  ] = transformed_optimization_config
          # 2. add versions information
          if model_name in version_info:
              transformed_config["versions"] = version_info[model_name]
          if (
              "platform" in model_config
              and model_config["platform"] == "ensemble"
          ):  # emsemble model
              # 3. remove ensembleScheduling
              if "ensembleScheduling" in model_config:
                  if "step" in model_config["ensembleScheduling"]:
                      del transformed_config["ensembleScheduling"]
                      transformed_config["step"] = model_config[
                          "ensembleScheduling"
                      ]["step"]
                      # 4. add two virtual models(feed, fetch), and
                      # "modelType", "inputModels", "outputModels", "inputVars", "outputVars"
                      for model_config_in_step in transformed_config[
                          "step"
                      ]:
                          model_config_in_step["modelType"] = "normal"
                          model_config_in_step["inputModels"] = []
                          model_config_in_step["outputModels"] = []
                          model_config_in_step["inputVars"] = []
                          model_config_in_step["outputVars"] = []
  
                      transformed_config["step"].append(
                          {
                              "modelName": "feed",
                              "modelType": "virtual",
                              "inputModels": [],
                              "outputModels": [],
                              "inputVars": [],
                              "outputVars": [],
                          }
                      )
                      transformed_config["step"].append(
                          {
                              "modelName": "fetch",
                              "modelType": "virtual",
                              "inputModels": [],
                              "outputModels": [],
                              "inputVars": [],
                              "outputVars": [],
                          }
                      )
                      analyse_step_relationships(
                          transformed_config["step"],
                          transformed_config["input"],
                          transformed_config["output"],
                      )
                      exchange_format["ensembles"].append(
                          transformed_config
                      )
          elif "backend" in model_config:  # single model
              exchange_format["models"].append(transformed_config)
      return exchange_format
  
imports: import copy
  import json
  import os
  import random
  import re
  import signal
  import string
  from collections import defaultdict
  from subprocess import Popen
  from subprocess import STDOUT
  import google.protobuf.json_format
  import google.protobuf.text_format
  import psutil
  import requests
  from .proto.model_config_pb2 import ModelConfig
  from visualdl.utils.dir import FASTDEPLOYSERVER_PATH
label_desc: Use image node_id 7 for calling a global function with example usage: original_format_to_exchange_format(original_format, version_info) and returns: exchange_format