code: def _worker_handler(future, worker, pipe, timeout):
      
      result = _get_result(future, pipe, timeout)
  
      if isinstance(result, BaseException):
          if isinstance(result, ProcessExpired):
              result.exitcode = worker.exitcode
  
          future.set_exception(result)
      else:
          future.set_result(result)
  
      if worker.is_alive():
          stop_process(worker)
docs: Worker lifecycle manager.
  
      Waits for the worker to be perform its task,
      collects result, runs the callback and cleans up the process.