def METHOD_NAME(sample, kernel, anchor, border, fill_value=None, mode="same",
                    has_channels=False):
    assert mode in ("same", "valid"), f"{mode}"
    def baseline_call(plane):
        return scipy_baseline_plane(plane, kernel, anchor, border, fill_value, mode)
    ndim = len(sample.shape)
    if not has_channels:
        assert ndim in (2, 3)
        return baseline_call(sample)
    assert ndim in (3, 4)
    ndim = len(sample.shape)
    channel_dim = ndim - 1
    channel_first = sample.transpose([channel_dim] + [i for i in range(channel_dim)])
    out = np.stack([baseline_call(plane) for plane in channel_first], axis=channel_dim)
    return out