code: def load_old_model(
      model_file,
      backend="keras",
      model_name=None,
      custom_object_dict=None,
      **kwargs,
  ):
      """Loading an old keras model file. A thing wrapper around load_model
      that uses DeepNeuro's custom cost functions.
  
      Parameters
      ----------
      model_file : str
          At present, a filepath to a ".h5" keras file.
      backend : str, optional
          Specify 'keras' or 'tensorflow' backend for loading.
      model_name : str, optional
          If loading a Tensorflow model, you must specify which
          DeepNeuroModel architecture is loaded.
      custom_object_dict: dict, optional
          If you are loading a model with custom objects.
  
      Returns
      -------
      Keras model
          A Keras model object stored in the given filepath.
  
      """
  
      if backend == "keras":
          from keras.models import load_model, model_from_json
          from deepneuro.models.keras_model import KerasModel
  
          custom_objects = cost_function_dict(**kwargs)
  
          model_file_extension = nifti_splitext(model_file)[1]
  
          if model_file_extension == ".json":
              model = KerasModel(initial_build=False, **kwargs)
              with open(model_file, "r") as json_file:
                  loaded_model_json = json_file.read()
                  model.model = model_from_json(
                      loaded_model_json, custom_objects=custom_objects
                  )
              model.build_model(compute_output=False)
          else:
              model = KerasModel(
                  model=load_model(
                      model_file, custom_objects=custom_objects
                  )
              )
  
          # Necessary?
          model.build_model(compute_output=False)
  
          return model
  
      if backend == "tf" or backend == "tensorflow":
          import tensorflow as tf
  
          sess = tf.Session()
          # First let's load meta graph and restore weights
          saver = tf.train.import_meta_graph(model_file)
          saver.restore(sess, tf.train.latest_checkpoint("./"))
          return sess
  
imports: import csv
  from deepneuro.models.cost_functions import cost_function_dict
  from deepneuro.utilities.util import add_parameter, nifti_splitext
  from deepneuro.load.load import load
label_desc: Use image node_id 1 for calling a global function with example usage: load_old_model(model_file, backend, model_name, custom_object_dict) and returns: model, sess