def get_state(self, next_state=None):
        """
        Return current state object; set it first if `next_state` given.

        Parameter `next_state`: a string, the name of the next state.

        Exception: `UnknownStateError` raised if `next_state` unknown.
        """
        if next_state:
            if self.debug and next_state != self.current_state:
                print >>self._stderr, (
                    '\nStateMachine.get_state: Changing state from '
                    '"%s" to "%s" (input line %s).'
                    % (self.current_state, next_state,
                       self.abs_line_number()))
            self.current_state = next_state
        try:
            return self.states[self.current_state]
        except __HOLE__:
            raise UnknownStateError(self.current_state)
dataset/ETHPy150Open adieu/allbuttonspressed/docutils/statemachine.py/StateMachine.get_state