code: def extract_query_dict(task, request_dict):
      required_keys = REQUIRED_KEYS_PER_TASK[task]
      query_dict = {}
      for key in required_keys:
          value = request_dict.pop(key, None)
          if value is None:
              raise ValueError(
                  "Request for task: {task} is missing required key: {key}."
              )
          query_dict[key] = value
      return query_dict
  
imports: import importlib
  import pickle
  import os
  import time
  import deepspeed
  from dataclasses import dataclass
  from typing import List, TYPE_CHECKING
  from datetime import timedelta
  from huggingface_hub import HfApi
  from transformers import AutoConfig
  import mii
  from mii.constants import MII_CACHE_PATH, MII_CACHE_PATH_DEFAULT, REQUIRED_KEYS_PER_TASK, MII_HF_CACHE_EXPIRATION, MII_HF_CACHE_EXPIRATION_DEFAULT
  from mii.logging import logger
  from mii.score.generate import generated_score_path
label_desc: Use image node_id 9 for calling a global function with example usage: extract_query_dict(task, request_dict) and returns: query_dict