def mirror(f):
    """
    Creates a new interpolating function by taking a interpolating function, flipping it and placing the reflected
    version beside itself. This does not just flips the function, rather combines the original and the flipped version.

    .. plot::

        import animator as am
        x = np.linspace(0, 1, 100)
        plt.plot(x, np.vectorize(am.interp.cubic_inout)(x), label="original")
        plt.plot(x, np.vectorize(am.interp.mirror(am.interp.cubic_inout))(x), label="mirrored")
        plt.legend()
        plt.tight_layout()
        plt.show()

    :param f:
        The function to mirror.

    :return:
        The mirrored interpolating function.
    """
    return lambda t: f(2 * (t if t < .5 else 1 - t))