def tick(self):
        ''' Calls the current state's do_work() and checks for a transition '''
        next_state = self.state.check_transitions()
        
        if next_state is None:
            # Stick with this state
            self.state.do_work()
        else:
            # Next state found, transition to it
            self.state.exit()
            next_state.enter()
            self.state = next_state
 Calls the current state's do_work() and checks for a transition 
recipes/Python/578656_State_Machine_Framework_AI/recipe-578656.py