Java code generator in Python