def main(): sm = StateMachine() sm.register(state_no_match) sm.register(state_one_match) sm.register(state_both_match) some_string = "hello and welcome to you" initial_state = State() print sm.evaluate(initial_state, some_string) current_state = State() some_string_2 = "you and welcome to hello" print sm.evaluate(current_state, some_string_2)