class Filter(object):

    def __init__(self, filter_name=None):
        self.filter_name = filter_name

def __call__(self, function):
    my_jinja_env.filters[self.filter_name or function.__name__] = function
return function

@Filter()
def i_love_you(name):
    pass
Python lambdas in Jinja2