Actually generate valid python strings
An attempt at a State monad-based implementation