def validate_args(self, qubits: Sequence[Qid]) -> None:
        """Checks if this gate can be applied to the given qubits.

        By default checks if input is of type Qid and qubit count.
        Child classes can override.

        Args:
            qubits: The collection of qubits to potentially apply the gate to.

        Throws:
            ValueError: The gate can't be applied to the qubits.
        """
        if len(qubits) == 0:
            raise ValueError(
                "Applied a gate to an empty set of qubits. Gate: {}".format(
                    repr(self)))

        if len(qubits) != self.num_qubits():
            raise ValueError(
                'Wrong number of qubits for <{!r}>. '
                'Expected {} qubits but got <{!r}>.'.format(
                    self,
                    self.num_qubits(),
                    qubits))

        if any([not isinstance(qubit, Qid)
                for qubit in qubits]):
            raise ValueError(
                    'Gate was called with type different than Qid.')
Checks if this gate can be applied to the given qubits.

        By default checks if input is of type Qid and qubit count.
        Child classes can override.

        Args:
            qubits: The collection of qubits to potentially apply the gate to.

        Throws:
            ValueError: The gate can't be applied to the qubits.