def complement(f):
    """
    Takes a function ``f`` and returns a function that takes the same arguments
    as ``f``, has the same effects, if any, and returns the opposite truth
    value.
    """
    def _f(*args, **kw):
        return not f(*args, **kw)

    return _f