def _num_qubits(self, circuit: cirq.AbstractCircuit) -> int:
        """Returns the number of qubits in a circuit."""
        all_qubits = circuit.all_qubits()
        return cast(line_qubit.LineQubit, max(all_qubits)).x + 1
Returns the number of qubits in a circuit.
cirq-ionq/cirq_ionq/serializer.py