def format_field(self, value: Any, spec: str) -> str:
        """Method of string.Formatter that specifies the output of format()."""
        if isinstance(value, (float, int)):
            if isinstance(value, float):
                value = round(value, self.precision)
            if spec == 'half_turns':
                value = f'pi*{self._format_number(value)}' if value != 0 else '0'
                spec = ''
            else:
                value = self._format_number(value)
        elif isinstance(value, ops.Qid):
            value = self.qubit_id_map[value]
        elif isinstance(value, str) and spec == 'meas':
            value = self.meas_key_id_map[value]
            spec = ''
        return super().format_field(value, spec)
Method of string.Formatter that specifies the output of format().
cirq-core/cirq/protocols/qasm.py