def fail_when_undefined(value):
    'Filter to force a failure when the value is undefined.'
    if isinstance(value, jinja2.Undefined):
        value()
    return value
Filter to force a failure when the value is undefined.
def fail_when_undefined(value):
    
    if isinstance(value, jinja2.Undefined):
        value()
    return value