We recently introduced the online code template editor in GenMyModel for creating your own templates which generate code from your diagrams.The editor is a full-featured MTL tool runing in the browser.
You will find in this article few snapshots and details about the Python template of our library. In our sample library, the Python template produces the classes, attributes, inheritance relations, etc from the class diagrams. The template takes a UML model, browses its elements and translates the elements into code. The template is written in the standard MTL syntax (like Acceleo) and can easily be customized.
The full article is here: http://blog.genmymodel.com/online-python-code-generator.html