def apply_target(target, args=(), kwargs={}, callback=None, accept_callback=None, pid=None, getpid=os.getpid, propagate=(), monotonic=monotonic, **_):
 if accept_callback:
  accept_callback((pid or getpid()), monotonic())
 try:
  ret = target(*args, **kwargs)
 except propagate:
  raise
 except Exception:
  raise
 except (WorkerShutdown, WorkerTerminate):
  raise
 except BaseException as exc:
  try:
   reraise(WorkerLostError, WorkerLostError(repr(exc)), sys.exc_info()[2])
  except WorkerLostError:
   callback(ExceptionInfo())
 else:
  callback(ret)

def apply_target ( target , args = ( ) , kwargs = { } , callback = None , accept_callback = None , pid = None , getpid = os . getpid , propagate = ( ) , monotonic = monotonic , ** _ ) : if accept_callback : accept_callback ( ( pid or getpid ( ) ) , monotonic ( ) ) try : ret = target ( * args , ** kwargs ) except propagate : raise except Exception : raise except ( WorkerShutdown , WorkerTerminate ) : raise except BaseException as exc : try : reraise ( WorkerLostError , WorkerLostError ( repr ( exc ) ) , sys . exc_info ( ) [ 2 ] ) except WorkerLostError : callback ( ExceptionInfo ( ) ) else : callback ( ret )
apply function within pool context .