def _add_qasm_measure(self, qubit, cmembit, cregbit=None):
<EOL>outcome, probability = self._get_measure_outcome(qubit)<EOL>membit = <NUM_LIT:1> << cmembit<EOL>self._classical_memory = (self._classical_memory & (~membit)) | (int(outcome) << cmembit)<EOL>if cregbit is not None:<EOL><INDENT>regbit = <NUM_LIT:1> << cregbit<EOL>self._classical_register =(self._classical_register & (~regbit)) | (int(outcome) << cregbit)<EOL><DEDENT>if outcome == '<STR_LIT:0>':<EOL><INDENT>update_diag = [[<NUM_LIT:1> / np.sqrt(probability), <NUM_LIT:0>], [<NUM_LIT:0>, <NUM_LIT:0>]]<EOL><DEDENT>else:<EOL><INDENT>update_diag = [[<NUM_LIT:0>, <NUM_LIT:0>], [<NUM_LIT:0>, <NUM_LIT:1> / np.sqrt(probability)]]<EOL><DEDENT>self._add_unitary_single(update_diag, qubit)<EOL>
Apply a measure instruction to a qubit.

        Args:
            qubit (int): qubit is the qubit measured.
            cmembit (int): is the classical memory bit to store outcome in.
            cregbit (int, optional): is the classical register bit to store outcome in.