def with_qubits(self, *new_qubits: cirq.Qid) -> PauliSum:
        """Return a new PauliSum on `new_qubits`.

        Args:
            *new_qubits: `cirq.Qid` objects to replace existing
                qubit objects in this PauliSum.

        Returns:
            PauliSum with new_qubits replacing the previous
                qubits.

        Raises:
            ValueError: If len(new_qubits) != len(self.qubits).

        """
        qubits = self.qubits
        if len(new_qubits) != len(qubits):
            raise ValueError('Incorrect number of qubits for PauliSum.')
        qubit_map = dict(zip(qubits, new_qubits))
        new_pauli_strings = []
        for pauli_string in self:
            new_pauli_strings.append(pauli_string.map_qubits(qubit_map))
        return PauliSum.from_pauli_strings(new_pauli_strings)
Return a new PauliSum on `new_qubits`.

        Args:
            *new_qubits: `cirq.Qid` objects to replace existing
                qubit objects in this PauliSum.

        Returns:
            PauliSum with new_qubits replacing the previous
                qubits.

        Raises:
            ValueError: If len(new_qubits) != len(self.qubits).

        
cirq-core/cirq/ops/linear_combinations.py