code: def interactive(f):
      """decorator for making functions appear as interactively defined.
      This results in the function being linked to the user_ns as globals()
      instead of the module globals().
      """
  
      # build new FunctionType, so it can have the right globals
      # interactive functions never have closures, that's kind of the point
      if isinstance(f, FunctionType):
          mainmod = __import__("__main__")
          f = FunctionType(
              f.__code__,
              mainmod.__dict__,
              f.__name__,
              f.__defaults__,
          )
      # associate with __main__ for uncanning
      f.__module__ = "__main__"
      return f
  
imports: import warnings
  import copy
  import sys
  from types import FunctionType
  from ipython_genutils import py3compat
  from ipython_genutils.importstring import import_item
  from ipython_genutils.py3compat import string_types, iteritems, buffer_to_bytes, buffer_to_bytes_py2
  from traitlets.log import get_logger
label_desc: Use image node_id 2 for calling a global function with example usage: interactive(f) and returns: f