docs: def notify_ready(self, apply_result):
          """Called by the ApplyResult object (already registered via
          register_result()) that it is now ready (ie. the Job's result
          is available or an exception has been raised).
          \param apply_result ApplyResult object telling us that the job
          has been processed
          """
          got_first = False
          got_last = False
          self._lock.acquire()
          try:
              assert self._remaining > 0
              got_first = len(self._results) == self._remaining
              self._remaining -= 1
              got_last = self._remaining == 0
          finally:
              self._lock.release()
  
          if self._to_notify is not None:
              if self._as_iterator and got_first:
                  self._to_notify._set_value(iter(self))
              elif not self._as_iterator and got_last:
                  try:
                      lst = [r.get(0) for r in self._results]
                  except:
                      self._to_notify._set_exception()
                  else:
                      self._to_notify._set_value(lst)