def heatmap(self, key: str) -> cirq.Heatmap:
        """Return a heatmap for metrics that target single qubits.

        Args:
            key: The metric key to return a heatmap for.

        Returns:
            A `cirq.Heatmap` for the metric.

        Raises:
            ValueError: If the heatmap is not for one/two qubits or the metric
                values are not single floats.
        """
        metrics = self[key]
        if not all(len(k) == 1 for k in metrics.values()):
            raise ValueError(
                'Heatmaps are only supported if all values in a metric are single metric values.'
                + f'{key} has metric values {metrics.values()}'
            )
        value_map = {self.key_to_qubits(k): self.value_to_float(v) for k, v in metrics.items()}
        if all(len(k) == 1 for k in value_map.keys()):
            return cirq.Heatmap(value_map, title=key.replace('_', ' ').title())
        elif all(len(k) == 2 for k in value_map.keys()):
            return cirq.TwoQubitInteractionHeatmap(value_map, title=key.replace('_', ' ').title())
        raise ValueError(
            'Heatmaps are only supported if all the targets in a metric are one or two qubits.'
            + f'{key} has target qubits {value_map.keys()}'
        )
Return a heatmap for metrics that target single qubits.

        Args:
            key: The metric key to return a heatmap for.

        Returns:
            A `cirq.Heatmap` for the metric.

        Raises:
            ValueError: If the heatmap is not for one/two qubits or the metric
                values are not single floats.
        
cirq-google/cirq_google/engine/calibration.py