code: def load_cands(path, lines_have_ids=False, cands_are_replies=False):
      """
      Load global fixed set of candidate labels that the teacher provides.
  
      Every example will include these as candidates. The true labels for a specific
      example are also added to this set, so that it's possible to get the right answer.
      """
      if path is None:
          return None
      cands = []
      cnt = 0
      with PathManager.open(path) as read:
          for line in read:
              line = line.strip().replace("\\n", "\n")
              if len(line) > 0:
                  cnt = cnt + 1
                  # If lines are numbered we strip them of numbers.
                  if cnt == 1 and line[0:2] == "1 ":
                      lines_have_ids = True
                  # If tabs then the label_candidates are all the replies.
                  if "\t" in line and not cands_are_replies:
                      cands_are_replies = True
                      cands = []
                  if lines_have_ids:
                      space_idx = line.find(" ")
                      line = line[space_idx + 1 :]
                      if cands_are_replies:
                          sp = line.split("\t")
                          if len(sp) > 1 and sp[1] != "":
                              cands.append(sp[1])
                      else:
                          cands.append(line)
                  else:
                      cands.append(line)
      return cands
  
imports: from collections import deque, OrderedDict
  from typing import Union, Optional, Set, Any, Dict, List, Tuple
  from datetime import timedelta
  import functools
  import math
  import time
  import re
  import shutil
  import json
  import os
  from parlai.core.message import Message
  from parlai.utils.strings import colorize
  from parlai.utils.io import PathManager
  import parlai.utils.logging
label_desc: Use image node_id 2 for calling a global function with example usage: load_cands(path, lines_have_ids, cands_are_replies) and returns: cands, None