def fork_task_context(functor, context=None):
 context = (context or Context.get_instance())
 xheader = context.hook_get_task_context()
 def wrapped(*args, **kargs):
  context.hook_load_task_context(xheader)
  return functor(*args, **kargs)
 return wrapped

def fork_task_context ( functor , context = None ) : context = ( context or Context . get_instance ( ) ) xheader = context . hook_get_task_context ( ) def wrapped ( * args , ** kargs ) : context . hook_load_task_context ( xheader ) return functor ( * args , ** kargs ) return wrapped
wrap a functor to transfer context .