code: def quality_checks_qids(
      qids_to_relevant_passageids, qids_to_ranked_candidate_passages
  ):
      """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
      """
      message = ""
      allowed = True
  
      # Create sets of the QIDs for the submitted and reference queries
      candidate_set = set(qids_to_ranked_candidate_passages.keys())
      ref_set = set(qids_to_relevant_passageids.keys())
  
      # Check that we do not have multiple passages per query
      for qid in qids_to_ranked_candidate_passages:
          # Remove all zeros from the candidates
          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
  
file_path: FARM/farm/evaluation/msmarco_passage_official.py
imports: import sys
  import statistics
  from collections import Counter
label_desc: Use image node_id 5 for calling a global function with example usage: quality_checks_qids(qids_to_relevant_passageids, qids_to_ranked_candidate_passages) and returns: allowed,  message