def quality_checks_qids(qids_to_relevant_passageids, qids_to_ranked_candidate_passages):
    'Perform quality checks on the dictionaries\n    Args:\n    p_qids_to_relevant_passageids (dict): dictionary of query-passage mapping\n        Dict as read in with load_reference or load_reference_from_stream\n    p_qids_to_ranked_candidate_passages (dict): dictionary of query-passage candidates\n    Returns:\n        bool,str: Boolean whether allowed, message to be shown in case of a problem\n    '
    message = ''
    allowed = True
    candidate_set = set(qids_to_ranked_candidate_passages.keys())
    ref_set = set(qids_to_relevant_passageids.keys())
    for qid in qids_to_ranked_candidate_passages:
        duplicate_pids = set([item for (item, count) in Counter(qids_to_ranked_candidate_passages[qid]).items() if (count > 1)])
        if (len((duplicate_pids - set([0]))) > 0):
            message = 'Cannot rank a passage multiple times for a single query. QID={qid}, PID={pid}'.format(qid=qid, pid=list(duplicate_pids)[0])
            allowed = False
    return (allowed, message)
Perform quality checks on the dictionaries
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:
    bool,str: Boolean whether allowed, message to be shown in case of a problem
def quality_checks_qids(qids_to_relevant_passageids, qids_to_ranked_candidate_passages):
    'Perform quality checks on the dictionaries\n    Args:\n    p_qids_to_relevant_passageids (dict): dictionary of query-passage mapping\n        Dict as read in with load_reference or load_reference_from_stream\n    p_qids_to_ranked_candidate_passages (dict): dictionary of query-passage candidates\n    Returns:\n        bool,str: Boolean whether allowed, message to be shown in case of a problem\n    '
    message = 
    allowed = True
    candidate_set = set(qids_to_ranked_candidate_passages.keys())
    ref_set = set(qids_to_relevant_passageids.keys())
    for qid in qids_to_ranked_candidate_passages:
        duplicate_pids = set([item for (item, count) in Counter(qids_to_ranked_candidate_passages[qid]).items() if (count > 1)])
        if (len((duplicate_pids - set([0]))) > 0):
            message = 'Cannot rank a passage multiple times for a single query. QID={qid}, PID={pid}'.format(qid=qid, pid=list(duplicate_pids)[0])
            allowed = False
    return (allowed, message)