def METHOD_NAME(a, window):
    """
    Make an ndarray with a rolling window of the last dimension
    This used to use the trick from
    http://www.mail-archive.com/numpy-discussion@scipy.org/msg29450.html,
    but numpy 1.20+ has newer primitives.
    Parameters
    ----------
    a : array_like
        Array to add rolling window to
    window : int
        Size of rolling window
    Returns
    -------
    Array that is a view of the original array with a added dimension
    of size w.
    Examples
    --------
    >>> x=np.arange(10).reshape((2,5))
    >>> rolling_window(x, 3)
    array([[[0, 1, 2], [1, 2, 3], [2, 3, 4]],
           [[5, 6, 7], [6, 7, 8], [7, 8, 9]]])
    Calculate rolling mean of last dimension:
    >>> np.mean(rolling_window(x, 3), -1)
    array([[ 1.,  2.,  3.],
           [ 6.,  7.,  8.]])
    """
    return np.lib.stride_tricks.sliding_window_view(a, window, axis=-1)