code: def get_metric_value_by_labels(messages, _metric, _m, metric_suffix):
          
          metric_name = '{}_{}'.format(_m, metric_suffix)
          expected_labels = set(
              [(k, v) for k, v in iteritems(_metric["labels"]) if k not in PrometheusScraperMixin.UNWANTED_LABELS]
          )
          for elt in messages[metric_name]:
              current_labels = set(
                  [(k, v) for k, v in iteritems(elt["labels"]) if k not in PrometheusScraperMixin.UNWANTED_LABELS]
              )
              # As we have two hashable objects we can compare them without any side effects
              if current_labels == expected_labels:
                  return float(elt["value"])
  
          raise AttributeError("cannot find expected labels for metric %s with suffix %s" % (metric_name, metric_suffix))
docs: :param messages: dictionary as metric_name: {labels: {}, value: 10}
          :param _metric: dictionary as {labels: {le: '0.001', 'custom': 'value'}}
          :param _m: str as metric name
          :param metric_suffix: str must be in (count or sum)
          :return: value of the metric_name matched by the labels