code: def instantiate_model_signature(
      model, signature, inputs=None, outputs=None
  ):
      """Imports a trained model and returns one of its signatures as a function."""
      string = load_cached(model + ".metagraph")
      metagraph = tf.compat.v1.MetaGraphDef()
      metagraph.ParseFromString(string)
      wrapped_import = tf.compat.v1.wrap_function(
          lambda: tf.compat.v1.train.import_meta_graph(metagraph), []
      )
      graph = wrapped_import.graph
      if inputs is None:
          inputs = metagraph.signature_def[signature].inputs
          inputs = [
              graph.as_graph_element(inputs[k].name)
              for k in sorted(inputs)
          ]
      else:
          inputs = [graph.as_graph_element(t) for t in inputs]
      if outputs is None:
          outputs = metagraph.signature_def[signature].outputs
          outputs = [
              graph.as_graph_element(outputs[k].name)
              for k in sorted(outputs)
          ]
      else:
          outputs = [graph.as_graph_element(t) for t in outputs]
      return wrapped_import.prune(inputs, outputs)
  
imports: import argparse
  import io
  import os
  import sys
  import urllib
  from absl import app
  from absl.flags import argparse_flags
  import numpy
  import tensorflow
  import tensorflow_compression
label_desc: Use image node_id 4 for calling a global function with example usage: instantiate_model_signature(model, signature, inputs, outputs) and returns: wrapped_import