def _reverse(array, dim):
    """Reverse an `xarray.DataArray` along a given dimension."""
    slicers = [slice(0, None)] * array.ndim
    slicers[dim] = slice(-1, None, -1)
    return array[tuple(slicers)]