def has_register(self, register):
has_reg = False<EOL>if (isinstance(register, QuantumRegister) and<EOL>register in self.qregs):<EOL><INDENT>has_reg = True<EOL><DEDENT>elif (isinstance(register, ClassicalRegister) and<EOL>register in self.cregs):<EOL><INDENT>has_reg = True<EOL><DEDENT>return has_reg<EOL>
Test if this circuit has the register r.

Args:
    register (Register): a quantum or classical register.

Returns:
    bool: True if the register is contained in this circuit.