code: def get_metric_type(d: Dict[str, Any]) -> str:
      for k, _ in d.items():
          if k.startswith(EVAL):
              return EVAL
          elif k.startswith(TEST):
              return TEST
          elif k.startswith(TRAIN_AVG):
              return TRAIN_AVG
          else:
              return TRAIN
      return TRAIN
  
imports: import json
  import logging
  import os
  from typing import Any, Dict, List, Optional, Tuple
  from transformers import TrainerCallback, TrainerControl, TrainerState, TrainingArguments
  from transformers.trainer_utils import get_last_checkpoint
  import determined
label_desc: Use image node_id 1 for calling a global function with example usage: get_metric_type(d) and returns: TRAIN, EVAL, TEST, TRAIN_AVG, TRAIN