def iffy(pred, action=EMPTY, default=identity):
    """Creates a function, which conditionally applies action or default."""
    if action is EMPTY:
        return iffy(bool, pred, default)
    else:
        pred = make_pred(pred)
        action = make_func(action)
        return lambda v: action(v)  if pred(v) else           \
                         default(v) if callable(default) else \
                         default
Creates a function, which conditionally applies action or default.
funcy/funcs.py