Added template filter support to generator.py
Refactored and added more functional example.