def METHOD_NAME(**kwargs):
    iw = ignore_warnings(**kwargs)
    with handling_exceptions():
        yield
    try:
        _ignored_warnings.remove(iw)
    except ValueError:
        # In case clear_warnings was called inside this context, ValueError will be raised
        pass