code: def convert_function_input(input):
      """
      Upgrade a input shortcut to an In instance.
  
      The rules for upgrading are as follows:
  
      - a `Variable` instance r will be upgraded like `In`(r)
  
      - a tuple (name, r) will be `In`(r, name=name)
  
      - a tuple (r, val) will be `In`(r, value=value, autoname=True)
  
      - a tuple ((r,up), val) will be
        `In`(r, value=value, update=up, autoname=True)
  
      - a tuple (name, r, val) will be `In`(r, name=name, value=value)
  
      - a tuple (name, (r,up), val) will be
        `In`(r, name=name, value=val, update=up, autoname=True)
  
      """
      if isinstance(input, SymbolicInput):
          return input
      elif isinstance(input, gof.Constant):
          raise TypeError(
              "A Constant instance is not a legal function input", input
          )
      elif isinstance(input, gof.Variable):
          return In(input)
      elif isinstance(input, (list, tuple)):
          orig = input
          if not input:
              raise TypeError(
                  "Nonsensical input specification: %s" % input
              )
          if isinstance(input[0], string_types):
              name = input[0]
              input = input[1:]
          else:
              name = None
          if isinstance(input[0], (list, tuple)):
              if len(input[0]) != 2 or len(input) != 2:
                  raise TypeError(
                      "Invalid input syntax: %s (check "
                      "documentation or use an In instance)" % orig
                  )
              (variable, update), value = input
          elif isinstance(input[0], gof.Variable):
              if len(input) == 1:
                  variable, update, value = input[0], None, None
              elif len(input) == 2:
                  (variable, value), update = input, None
              else:
                  raise TypeError(
                      "Invalid input syntax: %s (check "
                      "documentation or use an In instance)" % orig
                  )
          elif isinstance(input[0], SymbolicInput):
              if len(input) == 1:
                  return input[0]
              elif len(input) == 2:
                  input, value = input
                  if name is not None:
                      input.name = name
                  input.value = value
                  return input
          else:
              raise TypeError(
                  "The input specification is not valid: %s" % input
              )
  
          if not isinstance(variable, gof.Variable):
              raise TypeError(
                  "Unknown input type: %s, expected Variable "
                  "instance" % type(variable),
                  variable,
              )
          if update is not None and not isinstance(
              update, gof.Variable
          ):
              raise TypeError(
                  "Unknown update type: %s, expected Variable "
                  "instance" % type(update),
                  update,
              )
          if value is not None and isinstance(
              value, (gof.Variable, SymbolicInput)
          ):
              raise TypeError(
                  "The value for input %s should not be a Variable "
                  "or SymbolicInput instance (got: %s)"
                  % (variable, value)
              )
  
          return In(variable, name=name, value=value, update=update)
      else:
          raise TypeError(
              "Unknown input type: %s, expected Variable instance"
              % type(input),
              input,
          )
  
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 13 for calling a global function with example usage: convert_function_input(input) and returns: input, In, In, input, input