while newstate is not None:
assert isinstance(newstate, StateMachine.State), "I should get a state"
self.current_state.on_leave()
while newstate is not None:
assert isinstance(newstate, StateMachine.State), "I should get a state"
self.current_state.on_leave()