nodes: 0, module; 1, function_definition; 2, function_name:wait_for_registration; 3, parameters; 4, block; 5, identifier:self; 6, identifier:processor_type; 7, expression_statement; 8, with_statement; 9, comment:"""Waits for a particular processor type to register or until
          is_cancelled is True. is_cancelled cannot be part of this class
          since we aren't cancelling all waiting for a processor_type,
          but just this particular wait.
  
          Args:
              processor_type (ProcessorType): The family, and version of
                  the transaction processor.
  
          Returns:
              None
          """; 10, with_clause; 11, block; 12, with_item; 13, expression_statement; 14, if_statement; 15, attribute; 16, call; 17, call; 18, block; 19, identifier:self; 20, identifier:_condition; 21, attribute; 22, argument_list; 23, attribute; 24, argument_list; 25, raise_statement; 26, attribute; 27, identifier:wait_for; 28, lambda; 29, attribute; 30, identifier:is_set; 31, call; 32, identifier:self; 33, identifier:_condition; 34, parenthesized_expression; 35, identifier:self; 36, identifier:_cancelled_event; 37, identifier:WaitCancelledException; 38, argument_list; 39, boolean_operator; 40, comparison_operator:processor_type in self; 41, call; 42, identifier:processor_type; 43, identifier:self; 44, attribute; 45, argument_list; 46, attribute; 47, identifier:is_set; 48, identifier:self; 49, identifier:_cancelled_event
code: def wait_for_registration(self, processor_type):
          """Waits for a particular processor type to register or until
          is_cancelled is True. is_cancelled cannot be part of this class
          since we aren't cancelling all waiting for a processor_type,
          but just this particular wait.
  
          Args:
              processor_type (ProcessorType): The family, and version of
                  the transaction processor.
  
          Returns:
              None
          """
          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()