code: def clone(
      output,
      replace=None,
      strict=True,
      share_inputs=True,
      copy_inputs=DEPRECATED_ARG,
  ):
      """
      Function that allows replacing subgraphs of a computational graph.
  
      It returns a copy of the initial subgraph with the corresponding
      substitutions.
  
      Parameters
      ----------
      output : Theano Variables (or Theano expressions)
          Theano expression that represents the computational graph.
      replace : dict
          Dictionary describing which subgraphs should be replaced by what.
      share_inputs : bool
          If True, use the same inputs (and shared variables) as the original
          graph. If False, clone them. Note that cloned shared variables still
          use the same underlying storage, so they will always have the same
          value.
      copy_inputs
          Deprecated, use share_inputs.
  
      """
      if copy_inputs is not DEPRECATED_ARG:
          warnings.warn(
              "In `clone()` function, the argument `copy_inputs` has been deprecated and renamed into `share_inputs`"
          )
          assert share_inputs  # since we used `copy_inputs` we should have default value for `share_inputs`
          share_inputs = copy_inputs
  
      if isinstance(replace, dict):
          items = list(replace.items())
      elif isinstance(replace, (list, tuple)):
          items = replace
      elif replace is None:
          items = []
      else:
          raise ValueError(
              (
                  "replace is neither a dictionary, list, "
                  "tuple or None ! The value provided is %s,"
                  "of type %s"
              )
              % (str(replace), str(type(replace)))
          )
      tmp_replace = [(x, x.type()) for x, y in items]
      new_replace = [
          (x, y) for ((_, x), (_, y)) in zip(tmp_replace, items)
      ]
      _, _outs, _ = rebuild_collect_shared(
          output, [], tmp_replace, [], strict, share_inputs
      )
  
      # TODO Explain why we call it twice ?!
      _, outs, _ = rebuild_collect_shared(
          _outs, [], new_replace, [], strict, share_inputs
      )
  
      return outs
  
imports: from __future__ import absolute_import, print_function, division
  import copy
  import logging
  import warnings
  from collections import OrderedDict
  import numpy
  import theano
  from theano.compat import izip
  from six import string_types, iteritems
  from six.moves import xrange
  from theano.compile.pfunc import rebuild_collect_shared
  from theano import gof, compat
  from theano import tensor, scalar
  from theano.tensor.basic import get_scalar_constant_value
label_desc: Use image node_id 4 for calling a global function with example usage: clone(output, replace, strict, share_inputs, copy_inputs) and returns: outs