def completion(callback):
 def _completion(f):
  def __completion(*a, **b):
   d = None
   try:
    d = f(*a, **b)
    return d
   finally:
    thread.start_new_thread(callback, (d,))
  return __completion
 return _completion

def completion ( callback ) : def _completion ( f ) : def __completion ( * a , ** b ) : d = None try : d = f ( * a , ** b ) return d finally : thread . start_new_thread ( callback , ( d , ) ) return __completion return _completion
executes a task on completion of the called action .