code: def analyse_step_relationships(
      step_config, inputs, outputs
  ):  # noqa: C901
      """
    Analyse model relationships in ensemble step. And fill  \
      "inputModels", "outputModels", "inputVars", "outputVars" in step_config.
    step_config: step data in ensemble model config.
    inputs: inputs in ensemble model config.
    outputs: outputs in ensemble model config.
    """
      models_dict = {}
      vars_dict = {}
      for model_config_in_step in step_config:
          models_dict[
              model_config_in_step["modelName"]
          ] = model_config_in_step
          if model_config_in_step["modelType"] == "virtual":
              for var in inputs:
                  if var["name"] not in vars_dict:
                      vars_dict[var["name"]] = {}
                      vars_dict[var["name"]]["from_models"] = set()
                      vars_dict[var["name"]]["to_models"] = set()
                  vars_dict[var["name"]]["from_models"].add("feed")
              for var in outputs:
                  if var["name"] not in vars_dict:
                      vars_dict[var["name"]] = {}
                      vars_dict[var["name"]]["from_models"] = set()
                      vars_dict[var["name"]]["to_models"] = set()
                  vars_dict[var["name"]]["to_models"].add("fetch")
          else:
              for var_placehold_name, var_name in model_config_in_step[
                  "inputMap"
              ].items():
                  if var_name not in vars_dict:
                      vars_dict[var_name] = {}
                      vars_dict[var_name]["from_models"] = set()
                      vars_dict[var_name]["to_models"] = set()
                  vars_dict[var_name]["to_models"].add(
                      model_config_in_step["modelName"]
                  )
  
              for var_placehold_name, var_name in model_config_in_step[
                  "outputMap"
              ].items():
                  if var_name not in vars_dict:
                      vars_dict[var_name] = {}
                      vars_dict[var_name]["from_models"] = set()
                      vars_dict[var_name]["to_models"] = set()
                  vars_dict[var_name]["from_models"].add(
                      model_config_in_step["modelName"]
                  )
      for var_name, relationships in vars_dict.items():
          for from_model in relationships["from_models"]:
              models_dict[from_model]["outputVars"].append(var_name)
              for var_to_model in relationships["to_models"]:
                  if (
                      var_to_model
                      not in models_dict[from_model]["outputModels"]
                  ):
                      models_dict[from_model]["outputModels"].append(
                          var_to_model
                      )
          for to_model in relationships["to_models"]:
              models_dict[to_model]["inputVars"].append(var_name)
              for var_from_model in relationships["from_models"]:
                  if (
                      var_from_model
                      not in models_dict[to_model]["inputModels"]
                  ):
                      models_dict[to_model]["inputModels"].append(
                          var_from_model
                      )
      calculate_layout_for_frontend(models_dict)
  
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 8 for calling a global function with example usage: analyse_step_relationships(step_config, inputs, outputs) without return types