code: def get_worker_eval_function(role_qname: str, onboarding_qname: str):
      """
      Returns the callback function that is used for checking worker qualification.
  
      Check `worker_can_do_unit` of `SharedTaskState` in Mephisto.
      """
  
      def worker_eval_function(worker, unit):
          """
          Checks the worker qualification for the task, based on their existing records.
          """
          worker_qualification = worker.get_granted_qualification(
              role_qname
          )
          if not worker_qualification:
              # has not done any onboarding training yet
              logging.debug(
                  "Worker does not have any qualifications (new worker)."
              )
              return True
  
          qualification_status = worker_qualification.value
          logging.debug(
              f"Worker role qualification is {qualification_status}"
          )
          if qualification_status in (
              constants.WIZARD_IN_TRAINING,
              constants.APPRENTICE_IN_TRAINING,
          ):
              # The agent had started the onboarding training but was not finished
              onboarding_qual = worker.get_granted_qualification(
                  onboarding_qname
              )
              return not onboarding_qual or not onboarding_qual.value
  
          # The agent has successfully finished the onboarding training
          if unit.unit_index == 0:
              return qualification_status == constants.WIZARD
          else:
              return qualification_status == constants.APPRENTICE
  
      return worker_eval_function
  
imports: import random
  import os
  from collections import defaultdict
  import hydra
  from omegaconf import DictConfig
  from dataclasses import dataclass, field
  from typing import List, Dict, Any
  from parlai.crowdsourcing.projects.wizard_of_internet import constants
  from parlai.crowdsourcing.projects.wizard_of_internet.wizard_internet_blueprint import WIZARD_INTERNET_PARLAICHAT_BLUEPRINT
  from parlai.crowdsourcing.utils.mturk import MTurkRunScriptConfig
  import parlai.utils.logging
  from mephisto.abstractions.databases.local_database import LocalMephistoDB
  from mephisto.abstractions.blueprints.parlai_chat.parlai_chat_blueprint import SharedParlAITaskState
  from mephisto.operations.operator import Operator
  from mephisto.operations.hydra_config import register_script_config
  from mephisto.tools.scripts import load_db_and_process_config
label_desc: Use image node_id 7 for calling a global function with example usage: get_worker_eval_function(role_qname, onboarding_qname) and returns: worker_eval_function, True, unknown, unknown, unknown