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. Below are a 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.