def METHOD_NAME(testcase, message='', category=Warning, force_gc=False):
    """Context manager to check that no warnings are emitted.
    This context manager enables a given warning within its scope
    and checks that no warnings are emitted even with that warning
    enabled.
    If force_gc is True, a garbage collection is attempted before checking
    for warnings. This may help to catch warnings emitted when objects
    are deleted, such as ResourceWarning.
    Other keyword arguments are passed to warnings.filterwarnings().
    """
    from test.support import gc_collect
    with warnings.catch_warnings(record=True) as warns:
        warnings.filterwarnings('always',
                                message=message,
                                category=category)
        yield
        if force_gc:
            gc_collect()
    testcase.assertEqual(warns, [])