import functools
import warnings


def ignore_warnings(category):
    """Returns a decorator to ignore all warnings
    in the specified category.

    Parameters
    ----------
    category : class
        Any warning that is a subclass of this category is ignored.

    Returns
    -------
    decorator_ignore : function
        A decorator that ignores all warnings in the category.
    """
    def decorator_ignore(fn):
        @functools.wraps(fn)
        def fn_ignore(*args, **kwargs):
            with warnings.catch_warnings():
                warnings.simplefilter("ignore", category)
                return fn(*args, **kwargs)
        return fn_ignore
    return decorator_ignore