def METHOD_NAME(qids_to_relevant_passageids, qids_to_ranked_candidate_passages, per_query_score=False):
    """Compute MRR metric
    Args:    
    p_qids_to_relevant_passageids (dict): dictionary of query-passage mapping
        Dict as read in with load_reference or load_reference_from_stream
    p_qids_to_ranked_candidate_passages (dict): dictionary of query-passage candidates
    Returns:
        dict: dictionary of metrics {'MRR': <MRR Score>}
    """
    all_scores = {}
    MRR = 0
    qids_with_relevant_passages = 0
    ranking = []
    qid2score = {}
    for qid in qids_to_ranked_candidate_passages:
        MRR_i = 0.0
        if qid in qids_to_relevant_passageids:
            ranking.append(0)
            target_pid = qids_to_relevant_passageids[qid]
            candidate_pid = qids_to_ranked_candidate_passages[qid]
            for i in range(0,MaxMRRRank):
                if candidate_pid[i] in target_pid:
                    MRR += 1/(i + 1)
                    MRR_i += 1/(i + 1)
                    ranking.pop()
                    ranking.append(i+1)
                    break
        qid2score[qid] = MRR_i
    if len(ranking) == 0:
        raise IOError("No matching QIDs found. Are you sure you are scoring the evaluation set?")
    MRR = MRR/len(qids_to_relevant_passageids)
    all_scores['MRR @10'] = MRR
    all_scores['QueriesRanked'] = len(qids_to_ranked_candidate_passages)
    if per_query_score:
        per_query_scores = {"MRR@10": qid2score}
        return all_scores, per_query_scores
    return all_scores