def METHOD_NAME(expected_metric, candidate_metric):
    # Tuple of (score, weight)
    scores = [(_is_similar_text_score(expected_metric.name, candidate_metric.name), 3)]
    if expected_metric.type is not None:
        score = 1 if expected_metric.type == candidate_metric.type else 0
        scores.append((score, 1))
    if expected_metric.tags is not None:
        score = _is_similar_text_score(str(sorted(expected_metric.tags)), str(sorted(candidate_metric.tags)))
        scores.append((score, 1))
    if expected_metric.value is not None:
        score = 1 if expected_metric.value == candidate_metric.value else 0
        scores.append((score, 1))
    if expected_metric.hostname:
        score = _is_similar_text_score(expected_metric.hostname, candidate_metric.hostname)
        scores.append((score, 1))
    if expected_metric.device:
        # device is only present in metrics coming from the real agent in e2e tests
        score = _is_similar_text_score(expected_metric.device, candidate_metric.device)
        scores.append((score, 1))
    return _compute_score(scores)