def _should_dedupe_module_deprecation() -> bool:
    """Whether module deprecation warnings should be deduped or not.

    We should always dedupe when not called from test.
    We should only dedupe during tests if forced.
    """
    force_dedupe = "CIRQ_FORCE_DEDUPE_MODULE_DEPRECATION" in os.environ
    return not _called_from_test() or force_dedupe
Whether module deprecation warnings should be deduped or not.

    We should always dedupe when not called from test.
    We should only dedupe during tests if forced.
    
cirq-core/cirq/_compat.py