code: def comm_guard(type1, type2):
      def wrap(f):
          old_f = f.__globals__[f.__name__]
  
          def new_f(arg1, arg2, *rest):
              if (type1 is ANY_TYPE or isinstance(arg1, type1)) and (
                  type2 is ANY_TYPE or isinstance(arg2, type2)
              ):
                  pass
              elif (type1 is ANY_TYPE or isinstance(arg2, type1)) and (
                  type2 is ANY_TYPE or isinstance(arg1, type2)
              ):
                  arg1, arg2 = arg2, arg1
              else:
                  return old_f(arg1, arg2, *rest)
  
              variable = f(arg1, arg2, *rest)
              if variable is FALL_THROUGH:
                  return old_f(arg1, arg2, *rest)
              else:
                  return variable
  
          new_f.__name__ = f.__name__
  
          def typename(type):
              if isinstance(type, Keyword):
                  return str(type)
              elif isinstance(type, (tuple, list)):
                  return (
                      "(" + ", ".join([x.__name__ for x in type]) + ")"
                  )
              else:
                  return type.__name__
  
          new_f.__doc__ = (
              str(old_f.__doc__)
              + "\n"
              + ", ".join([typename(type) for type in (type1, type2)])
              + "\n"
              + str(f.__doc__ or "")
          )
          return new_f
  
      return wrap
  
imports: from __future__ import absolute_import, print_function, division
  import linecache
  import sys
  import traceback
  import numpy
  from six import iteritems, integer_types, string_types, with_metaclass
  from six.moves import StringIO
  from theano import config
  from theano.compat import PY3
label_desc: Use image node_id 12 for calling a global function with example usage: comm_guard(type1, type2) and returns: wrap, new_f, old_f, variable, str, old_f, unknown, type