import warnings


def deprecated_kwargs(func):
    """Decorator for open() functions warning of keyword argument usage."""

    def func_wrapper(*args, **kwargs):
        if kwargs:
            warnings.warn(
                "Using kwargs such in open() is deprecated and will have no effect."
            )
        if "resampling" in kwargs:
            raise DeprecationWarning(
                "'resampling' argument has no effect here and must be provided in read() "
                "function."
            )
        return func(*args, **kwargs)

    return func_wrapper