'Transition from the given `from_state` to the given `to_state`.
This method will return `True` if the state machine is now in `to_state`.  It
will return `False` if a timeout occurred the transition did not occur.
If `wait` is 0 (the default,) this method returns immediately if the state machine
is not in `from_state`.
If you want the thread to block and transition once the state machine to enters
`from_state`, set `wait` to a non-negative value.  Note there is no \'block
indefinitely\' flag since this leads to deadlock.  If you want to wait indefinitely,
choose a reasonable value for `wait` (e.g. 20 seconds) and do so in a while loop like so:
while not thread_should_exit and not state_machine.transition(\'disconnected\', \'connecting\', wait=20 ):
pass # timeout will occur every 20s unless transition occurs
if thread_should_exit: return
# perform actions here after successful transition
This allows the thread to be responsive by setting `thread_should_exit=True`.
The optional `func` argument allows the user to pass a callable operation which occurs
within the context of the state transition (e.g. while the state machine is locked.)
If `func` returns a True value, the transition will occur.  If `func` returns a non-
True value or if an exception is thrown, the transition will not occur.  Any thrown
exception is not caught by the state machine and is the caller\'s responsibility to handle.
If `func` completes normally, this method will return the value returned by `func.`  If
values for `args` and `kwargs` are provided, they are expanded and passed like so:
`func( *args, **kwargs )`.'

def transition(self, from_state, to_state, wait=0.0, func=None, args=None, kwargs=None):

    if (not args):
        args = []
    if (not kwargs):
        kwargs = {}
    return self.transition_any((from_state,), to_state, wait=wait, func=func, args=args, kwargs=kwargs)
