@contextlib.contextmanager<EOL>def check_warnings(*filters, **kwargs):
quiet = kwargs.get('<STR_LIT>')<EOL>if not filters:<EOL><INDENT>filters = (("<STR_LIT>", Warning),)<EOL>if quiet is None:<EOL><INDENT>quiet = True<EOL><DEDENT><DEDENT>return _filterwarnings(filters, quiet)<EOL>
Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)