def _sum_values_by_context(metric, uid_from_labels):
        """
        Iterates over all metrics in a metric and sums the values
        matching the same uid. Modifies the metric family in place.
        :param metric: prometheus metric family
        :param uid_from_labels: function mapping a metric.label to a unique context id
        :return: dict with uid as keys, metric object references as values
        """
        seen = {}
        for sample in metric.samples:
            uid = uid_from_labels(sample[OpenMetricsBaseCheck.SAMPLE_LABELS])
            if not uid:
                # TODO
                # metric.Clear()  # Ignore this metric message
                continue
            # Sum the counter value accross all contexts
            if uid not in seen:
                seen[uid] = sample
            else:
                # We have to create a new tuple
                seen[uid] = (
                    seen[uid][OpenMetricsBaseCheck.SAMPLE_NAME],
                    seen[uid][OpenMetricsBaseCheck.SAMPLE_LABELS],
                    seen[uid][OpenMetricsBaseCheck.SAMPLE_VALUE] + sample[OpenMetricsBaseCheck.SAMPLE_VALUE],
                )
                # TODO
                # metric.Clear()  # Ignore this metric message
        return seen
Iterates over all metrics in a metric and sums the values
        matching the same uid. Modifies the metric family in place.
        :param metric: prometheus metric family
        :param uid_from_labels: function mapping a metric.label to a unique context id
        :return: dict with uid as keys, metric object references as values