'Invokes a filter on a value the same way the compiler does it.
Note that on Python 3 this might return a coroutine in case the
filter is running from an environment in async mode and the filter
supports async execution.  It\'s your responsibility to await this
if needed.
.. versionadded:: 2.7'

def call_filter(self, name, value, args=None, kwargs=None, context=None, eval_ctx=None):

    func = self.filters.get(name)
    if (func is None):
        fail_for_missing_callable('no    filter    named    %r', name)
    args = ([value] + list((args or ())))
    if getattr(func, 'contextfilter', False):
        if (context is None):
            raise TemplateRuntimeError('Attempted    to    invoke    context    filter    without    context')
        args.insert(0, context)
    elif getattr(func, 'evalcontextfilter', False):
        if (eval_ctx is None):
            if (context is not None):
                eval_ctx = context.eval_ctx
            else:
                eval_ctx = EvalContext(self)
        args.insert(0, eval_ctx)
    elif getattr(func, 'environmentfilter', False):
        args.insert(0, self)
    return func(*args, **(kwargs or {}))
