if isinstance(qubit, Qubit):
if not self.has_register(q_control.register):
raise AquaError("The {} qubit is expected to be part of the circuit.".format(name))
elif isinstance(qubit, int):
if qubit >= self.n_qubits:
raise AquaError("Qubit index out of range.")
else:
raise AquaError("A qubit or int is expected for the {}.".format(name))
if q_control == q_target:
raise AquaError("The control and target need to be different qubits.")