simplifies python code in template