code: def require(*objects, **mapping):
      """Simple decorator for requiring local objects and modules to be available
      when the decorated function is called on the engine.
  
      Modules specified by name or passed directly will be imported
      prior to calling the decorated function.
  
      Objects other than modules will be pushed as a part of the task.
      Functions can be passed positionally,
      and will be pushed to the engine with their __name__.
      Other objects can be passed by keyword arg.
  
      Examples
      --------
      ::
  
          In [1]: @ipp.require('numpy')
             ...: def norm(a):
             ...:     return numpy.linalg.norm(a,2)
  
      ::
  
          In [2]: foo = lambda x: x*x
          In [3]: @ipp.require(foo)
             ...: def bar(a):
             ...:     return foo(1-a)
      """
      names = []
      for obj in objects:
          if isinstance(obj, ModuleType):
              obj = obj.__name__
  
          if isinstance(obj, str):
              names.append(obj)
          elif hasattr(obj, "__name__"):
              mapping[obj.__name__] = obj
          else:
              raise TypeError(
                  "Objects other than modules and functions "
                  "must be passed by kwarg, but got: %s" % type(obj)
              )
  
      for name, obj in mapping.items():
          mapping[name] = can(obj)
      return depend(_require, *names, **mapping)
  
file_path: ipyparallel/ipyparallel/controller/dependency.py
imports: from types import ModuleType
  from ipyparallel.client.asyncresult import AsyncResult
  from ipyparallel.error import UnmetDependency
  from ipyparallel.serialize import can
  from ipyparallel.util import interactive
label_desc: Use image node_id 2 for calling a global function with example usage: require() and returns: depend