import functools


def wrap_after(after, condition=lambda *args, **kwargs: True):
    """
    A helper for creating decorators.

    Runs an "after" function after the decorated function. The condition
    check is performed after the decorated function is called.

    """
    def decorator(func):
        @functools.wraps(func)
        def wrapped(*args, **kwargs):
            result = func(*args, **kwargs)
            if condition(*args, **kwargs):
                after()
            return result
        return wrapped
    return decorator