Didactic regular expression engine (thompson's nfa) in vanilla python (2.7+ and 3)