code: def _toState(self, state, *args, **kwargs):
          
          try:
              method = getattr(self, '_state_%s' % state)
          except AttributeError:
              raise ValueError("No such state %r" % state)
  
          log.msg("%s: to state %r" % (self.__class__.__name__, state))
          self._state = state
          method(*args, **kwargs)
docs: Transition to the next state.
  
          @param state: Name of the next state.