'Transition the work item to a new state, storing progress information.
Args:
new_state: The state to transition to.
blocking: Whether to block for the progress thread to acknowledge the
transition.'

def _StateTransition(self, new_state, blocking=False):

    assert (not self.progress_event.isSet())
    self.state = new_state
    self.progress_queue.put(self)
    if blocking:
        self.progress_event.wait()
        self.progress_event.clear()
