if kwargs:
    return ufmt_str.format(**kwargs)
return ufmt_str.format(*args)
env = Environment(loader=FileSystemLoader('./my/template/dir'))
env.filters.update({'format': format})
Jinja Templates - Format a float as comma-separated currency