Using pystache template to generate code from __main__.py

Also renamed Rule.rules to Rule.properties matching the vocabulary used
in the spec.