code: def wait_for_registration(self, processor_type):
          with self._condition:
              self._condition.wait_for(lambda: (
                  processor_type in self
                  or self._cancelled_event.is_set()))
              if self._cancelled_event.is_set():
                  raise WaitCancelledException()