Code generator implemented in Python