def generate_is_even(**kwargs):
    options = {'reject_zero': lambda x: x != 0}
enabled = [options[o] for o in options if o in kwargs and kwargs[o]]

def is_even(x):
    return all([fn(x) for fn in enabled]) and x % 2 == 0
return is_even
Can one use closures to simplify functions in Python?