def _validate_group_paulis_qwc(
    pauli_strs: list[ops.PauliString], all_qubits: list[ops.Qid] | frozenset[ops.Qid]
):
    """Checks if a group of Pauli strings are Qubit-Wise Commuting.

    Args:
        pauli_strings: A list of cirq.PauliString objects.
        all_qubits: A list of all qubits to consider for the QWC check.
                    The check is performed for each qubit in this list.

    Returns:
        True if the group is QWC, False otherwise.
    """
    if len(pauli_strs) <= 1:
        return True
    for p1, p2 in itertools.combinations(pauli_strs, 2):
        if not _are_two_pauli_strings_qubit_wise_commuting(p1, p2, all_qubits):
            return False
    return True
Checks if a group of Pauli strings are Qubit-Wise Commuting.

    Args:
        pauli_strings: A list of cirq.PauliString objects.
        all_qubits: A list of all qubits to consider for the QWC check.
                    The check is performed for each qubit in this list.

    Returns:
        True if the group is QWC, False otherwise.
    
cirq-core/cirq/contrib/paulistring/pauli_string_measurement_with_readout_mitigation.py