code: def insert_weights_into_nested_model_config(
      nested_model_weights, nested_model_layer_config
  ):
      for layer_config in nested_model_layer_config:
          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_name = layer_config["config"]["name"]
              layer_weights = [
                  np.array(nested_model_weights[x])
                  for x in nested_model_weights.keys()
                  if x.startswith(layer_name + "/")
              ]
              if len(layer_weights) > 0:
                  layer_config["config"]["weights"] = layer_weights
  
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 28 for calling a global function with example usage: insert_weights_into_nested_model_config(nested_model_weights, nested_model_layer_config) without return types