def transplant_func(func, module):
 from nose.tools import make_decorator
 if isgenerator(func):
  def newfunc(*arg, **kw):
   for v in func(*arg, **kw):
    (yield v)
 else:
  def newfunc(*arg, **kw):
   return func(*arg, **kw)
 newfunc = make_decorator(func)(newfunc)
 newfunc.__module__ = module
 return newfunc

def transplant_func ( func , module ) : from nose . tools import make_decorator if isgenerator ( func ) : def newfunc ( * arg , ** kw ) : for v in func ( * arg , ** kw ) : ( yield v ) else : def newfunc ( * arg , ** kw ) : return func ( * arg , ** kw ) newfunc = make_decorator ( func ) ( newfunc ) newfunc . __module__ = module return newfunc
make a function imported from module a appear as if it is located in module b .