def METHOD_NAME(orig, dimensions, method, offset, m1):
    """
    Resample Map using either linear or nearest interpolation.
    Parameters
    ----------
    orig : array-like
        Original data.
    dimensions : `tuple`
        Dimensions of resampled data.
    method : `str`
        Interpolation method passed to `~scipy.interpolate.interpn`
    offset : `float`
        Either 0 or 0.5, depending on whether interpolation is at the edge or
        centers of bins.
    m1 : 0 or 1
        For ``orig.shape = (i,j)`` & new dimensions ``= (x,y)``, if set to `False`
        (default) ``orig`` is resampled by factors of ``(i/x) * (j/y)``,
        otherwise ``orig`` is resampled by ``(i-1)/(x-1) * (j-1)/(y-1)``.
        This prevents extrapolation one element beyond bounds of input array.
    """
    old_coords = [np.arange(i, dtype=float) + offset for i in orig.shape]
    scale = (orig.shape - m1) / (dimensions - m1)
    new_coords = [(np.arange(dimensions[i], dtype=float) + offset) * scale[i] for i in
                  range(len(dimensions))]
    new_coords = np.stack(np.meshgrid(*new_coords, indexing='ij'), axis=-1)
    # fill_value = None extrapolates outside the domain
    new_data = scipy.interpolate.interpn(old_coords, orig, new_coords,
                                         method=method, bounds_error=False,
                                         fill_value=None)
    return new_data