def mirror(arr, axes=None):
    """ 
    Reverse array over many axes. Generalization of arr[::-1] for many dimensions.

    Parameters
    ----------
    arr : `~numpy.ndarray`
        Array to be reversed
    axes : int or tuple or None, optional
        Axes to be reversed. Default is to reverse all axes.
    
    Returns
    -------
    out : `~numpy.ndarray`
        Mirrored array.
    """
    if axes is None:
        reverse = [slice(None, None, -1)] * arr.ndim
    else:
        reverse = [slice(None, None, None)] * arr.ndim
        if isinstance(axes, int):
            axes = axes,
        for axis in axes:
            reverse[axis] = slice(None, None, -1)
    return arr[tuple(reverse)]
