code: def orig_function(
      inputs,
      outputs,
      mode=None,
      accept_inplace=False,
      name=None,
      profile=None,
      on_unused_input=None,
      output_keys=None,
  ):
      """
      Return a Function that will calculate the outputs from the inputs.
  
      Parameters
      ----------
      inputs : list of `SymbolicInput` or `In` instances
      outputs : a SymbolicOutput or a list of `SymbolicOutput` or `Out` instances
          The return value of the returned function will match the format of this
          argument (either the value itself or a list of one or more return
          values).
      mode : descriptive string or Mode instance
          Default of None means to use `config.mode` (see below for descriptive
          string list).
      name : str
          An optional name for this function. If used, the profile mode will print the
          time spent in this function.
      accept_inplace : bool
          True iff the graph can contain inplace operations prior to the
          optimization phase (default is False).
      profile : None or ProfileStats instance
      on_unused_input : {'raise', 'warn', 'ignore', None}
          What to do if a variable in the 'inputs' list is not used in the graph.
      output_keys :
          If the outputs were provided to theano.function as a list, then
          output_keys is None. Otherwise, if outputs were provided as a dict,
          output_keys is the sorted list of keys from the outputs.
  
      Notes
      -----
      Currently, the library provides the following mode strings:
  
      - FAST_RUN (default) (optimize without too much time)
  
      - FAST_COMPILE (minimal optimization)
  
      - DebugMode: verify many internal conditions that are normally assumed
        (slow)
  
      """
  
      # Every element of the input list will be upgraded to an `In` instance if
      # necessary, using the rules implemented by the `convert_function_input`
      # function.
  
      # Similarly, every element of the output list will be upgraded to an `Out`
      # instance if necessary:
  
      t1 = time.time()
      mode = theano.compile.mode.get_mode(mode)
  
      inputs = list(map(convert_function_input, inputs))
      if outputs is not None:
          if isinstance(outputs, (list, tuple)):
              outputs = list(map(FunctionMaker.wrap_out, outputs))
          else:
              outputs = FunctionMaker.wrap_out(outputs)
  
      defaults = [getattr(input, "value", None) for input in inputs]
  
      if isinstance(mode, (list, tuple)):  # "mode comparison" semantics
          raise Exception(
              "We do not support the passing of multiple modes"
          )
      fn = None
      try:
          Maker = getattr(mode, "function_maker", FunctionMaker)
          m = Maker(
              inputs,
              outputs,
              mode,
              accept_inplace=accept_inplace,
              profile=profile,
              on_unused_input=on_unused_input,
              output_keys=output_keys,
              name=name,
          )
          with theano.change_flags(compute_test_value="off"):
              fn = m.create(defaults)
      finally:
          t2 = time.time()
          if fn and profile:
              profile.compile_time += t2 - t1
              # TODO: append
              profile.nb_nodes = len(fn.maker.fgraph.apply_nodes)
  
      return fn
  
imports: from __future__ import absolute_import, print_function, division
  import copy
  from six import string_types, iteritems, iterkeys
  from six.moves import xrange
  import six.moves.copyreg
  import six.moves.cPickle
  from itertools import chain
  import time
  import warnings
  import numpy
  import theano
  from theano import config, gof
  from theano.compat import izip
  from theano.gof import graph
  import theano.compile.profiling
  from theano.compile.io import In, SymbolicInput, SymbolicOutput
  from theano.compile.ops import deep_copy_op, view_op
  from theano.gof.graph import is_same_graph
  from theano.gof.op import ops_with_inner_function
  import logging
label_desc: Use image node_id 12 for calling a global function with example usage: orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys) and returns: fn