code: def normalize_graph_config(conf, model_output, org_model_dir):
      conf = copy.deepcopy(conf)
      if ModelKeys.platform in conf:
          conf[ModelKeys.platform] = parse_platform(
              conf[ModelKeys.platform]
          )
      if (
          ModelKeys.model_file_path in conf
          and org_model_dir is not None
      ):
          model_file = util.download_or_get_model(
              conf[ModelKeys.model_file_path],
              conf[ModelKeys.model_sha256_checksum],
              org_model_dir,
          )
          conf[ModelKeys.model_file_path] = model_file
      if ModelKeys.weight_file_path in conf:
          weight_file = util.download_or_get_model(
              conf[ModelKeys.weight_file_path],
              conf[ModelKeys.weight_sha256_checksum],
              "/tmp/",
          )
          conf[ModelKeys.weight_file_path] = weight_file
  
      if ModelKeys.runtime in conf:
          conf[ModelKeys.runtime] = parse_device_type(
              conf[ModelKeys.runtime]
          )
  
      if ModelKeys.data_type in conf:
          conf[ModelKeys.data_type] = parse_internal_data_type(
              conf[ModelKeys.data_type]
          )
  
      # TODO: remove the following after quantize tool is made
      if (
          ModelKeys.quantize_range_file in conf
          and model_output is not None
      ):
          range_file = util.download_or_get_model(
              conf[ModelKeys.quantize_range_file], "", model_output
          )
          conf[ModelKeys.quantize_range_file] = range_file
  
      input_count = 0
      input_data_formats = []
      input_ranges = []
      if ModelKeys.input_tensors in conf:
          conf[ModelKeys.input_tensors] = to_list(
              conf[ModelKeys.input_tensors]
          )
          conf[ModelKeys.input_tensors] = [
              str(i) for i in conf[ModelKeys.input_tensors]
          ]
          input_count = len(conf[ModelKeys.input_tensors])
          input_data_formats = [
              parse_data_format(df)
              for df in to_list(
                  conf.get(ModelKeys.input_data_formats, ["NHWC"])
              )
          ]
          input_ranges = [
              parse_float_array(r)
              for r in to_list(
                  conf.get(ModelKeys.input_ranges, ["-1.0,1.0"])
              )
          ]
          normalize_input_data_types(conf, input_count)
  
      if ModelKeys.input_shapes in conf:
          conf[ModelKeys.input_shapes] = [
              parse_int_array(shape)
              for shape in to_list(conf[ModelKeys.input_shapes])
          ]
          mace_check(
              len(conf[ModelKeys.input_shapes]) == input_count,
              "input node count and shape count do not match",
          )
  
      if len(input_data_formats) == 1 and input_count > 1:
          input_data_formats = [input_data_formats[0]] * input_count
      mace_check(
          len(input_data_formats) == input_count,
          "the number of input_data_formats should be "
          "the same as input tensors",
      )
      conf[ModelKeys.input_data_formats] = input_data_formats
  
      if len(input_ranges) == 1 and input_count > 1:
          input_ranges = [input_ranges[0]] * input_count
      mace_check(
          len(input_ranges) == input_count,
          "the number of input_ranges should be "
          "the same as input tensors",
      )
      conf[ModelKeys.input_ranges] = input_ranges
  
      # parse output
      output_count = 0
      output_data_types = []
      output_data_formats = []
      if ModelKeys.output_tensors in conf:
          conf[ModelKeys.output_tensors] = to_list(
              conf[ModelKeys.output_tensors]
          )
          conf[ModelKeys.output_tensors] = [
              str(i) for i in conf[ModelKeys.output_tensors]
          ]
          output_count = len(conf[ModelKeys.output_tensors])
          output_data_formats = [
              parse_data_format(df)
              for df in to_list(
                  conf.get(ModelKeys.output_data_formats, ["NHWC"])
              )
          ]
          normalize_output_data_types(conf, output_count)
  
      if ModelKeys.output_shapes in conf:
          conf[ModelKeys.output_shapes] = [
              parse_int_array(shape)
              for shape in to_list(conf[ModelKeys.output_shapes])
          ]
          mace_check(
              len(conf[ModelKeys.output_tensors]) == output_count,
              "output node count and shape count do not match",
          )
  
      if len(output_data_formats) == 1 and output_count > 1:
          output_data_formats = [output_data_formats[0]] * output_count
      mace_check(
          len(output_data_formats) == output_count,
          "the number of output_data_formats should be "
          "the same as output tensors",
      )
      conf[ModelKeys.output_data_formats] = output_data_formats
  
      if ModelKeys.check_tensors in conf:
          conf[ModelKeys.check_tensors] = to_list(
              conf[ModelKeys.check_tensors]
          )
          conf[ModelKeys.check_shapes] = [
              parse_int_array(shape)
              for shape in to_list(conf[ModelKeys.check_shapes])
          ]
          mace_check(
              len(conf[ModelKeys.check_tensors])
              == len(conf[ModelKeys.check_shapes]),
              "check tensors count and shape count do not match.",
          )
      return conf
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import re
  import os
  import copy
  import yaml
  from enum import Enum
  from utils import util
  from utils.util import mace_check
  from utils.util import MaceLogger
  from py_proto import mace_pb2
label_desc: Use image node_id 14 for calling a global function with example usage: normalize_graph_config(conf, model_output, org_model_dir) and returns: conf