def _generate_cregs(self, meas_key_id_map: dict[str, str]) -> dict[str, tuple[int, str]]:
        """Pick an id for the creg that will store each measurement

        This function finds the largest measurement using each key.
        That is, if multiple measurements are made with the same key,
        it will use the key with the most number of qubits.

        Returns: dictionary with key of measurement id and value of (#qubits, comment).
        """
        cregs: dict[str, tuple[int, str]] = {}
        for meas in self.measurements:
            key = protocols.measurement_key_name(meas)
            meas_id = meas_key_id_map[key]

            if self.meas_comments[key] is not None:
                comment = f'  // Measurement: {self.meas_comments[key]}'
            else:
                comment = ''

            if meas_id not in cregs or cregs[meas_id][0] < len(meas.qubits):
                cregs[meas_id] = (len(meas.qubits), comment)

        return cregs
Pick an id for the creg that will store each measurement

        This function finds the largest measurement using each key.
        That is, if multiple measurements are made with the same key,
        it will use the key with the most number of qubits.

        Returns: dictionary with key of measurement id and value of (#qubits, comment).
        
cirq-core/cirq/circuits/qasm_output.py