docs: def num_qubits(self) -> Optional[int]:
          """Returns number of qubits in the domain if known, None if unknown."""
          if not self:
              return None
          any_gate = next(iter(self))
          return any_gate.num_qubits()