code: def convert_model_from_saved_files(
      h5_file, json_file=None, yaml_file=None, **kwargs
  ):
      assert (
          json_file is None or yaml_file is None
      ), "At most one of json_file and yaml_file can be specified"
      if json_file is not None:
          model_class_and_config = json.loads(open(json_file).read())
      elif yaml_file is not None:
          model_class_and_config = yaml.load(open(yaml_file))
      else:
          str_data = h5py.File(h5_file).attrs["model_config"]
          if hasattr(str_data, "decode"):
              str_data = str_data.decode("utf-8")
          model_class_and_config = json.loads(str_data)
      model_class_name = model_class_and_config["class_name"]
      model_config = model_class_and_config["config"]
  
      model_weights = h5py.File(h5_file)
      if "model_weights" in model_weights.keys():
          model_weights = model_weights["model_weights"]
  
      if model_class_name == "Sequential":
          if (
              isinstance(model_config, list) == False
          ):  # keras 2.2.3 API change
              model_config = model_config["layers"]
          layer_configs = model_config
          model_conversion_function = convert_sequential_model
      elif model_class_name == "Model":
          layer_configs = model_config["layers"]
          model_conversion_function = convert_functional_model
      else:
          raise NotImplementedError(
              "Don't know how to convert " + model_class_name
          )
  
      # add in the weights of the layer to the layer config
      for layer_config in layer_configs:
          layer_name = layer_config["config"]["name"]
          assert layer_name in model_weights, (
              "Layer "
              + layer_name
              + " is in the layer names but not in the "
              + " weights file which has layer names "
              + model_weights.keys()
          )
  
          if layer_config["class_name"] in ["Model", "Sequential"]:
              nested_model_weights = OrderedDict(
                  zip(
                      model_weights[layer_name].attrs["weight_names"],
                      [
                          model_weights[layer_name][x]
                          for x in model_weights[layer_name].attrs[
                              "weight_names"
                          ]
                      ],
                  )
              )
  
          if layer_config["class_name"] == "Model":
              insert_weights_into_nested_model_config(
                  nested_model_weights=nested_model_weights,
                  nested_model_layer_config=layer_config["config"][
                      "layers"
                  ],
              )
          elif layer_config["class_name"] == "Sequential":
              insert_weights_into_nested_model_config(
                  nested_model_weights=nested_model_weights,
                  nested_model_layer_config=(
                      layer_config["config"]
                      if isinstance(layer_config["config"], list)
                      else layer_config["config"]["layers"]
                  ),
              )
          else:
              layer_weights = [
                  np.array(model_weights[layer_name][x])
                  for x in model_weights[layer_name].attrs[
                      "weight_names"
                  ]
              ]
              layer_config["config"]["weights"] = layer_weights
  
      return model_conversion_function(
          model_config=model_config, **kwargs
      )
  
imports: from __future__ import division
  from __future__ import print_function
  from __future__ import absolute_import
  import sys
  import os
  from collections import OrderedDict
  import deeplift
  from deeplift import models, layers
  from deeplift.layers.core import NonlinearMxtsMode, DenseMxtsMode, ConvMxtsMode, MaxPoolDeepLiftMode
  import deeplift.util
  import numpy
  import json
  import yaml
  import h5py
label_desc: Use image node_id 27 for calling a global function with example usage: convert_model_from_saved_files(h5_file, json_file, yaml_file) and returns: model_conversion_function