def flip(func):
    """Reverses the arguments of a function.

    Parameters
    ----------
    func : function
        The original function.

    Returns
    -------
    function
        A function identical to `func` except it expects arguments in reverse.
    """
    def flipped(*args):
        return func(*args[::-1])
    return flipped