code: def eval_model(
      opt,
      skip_valid=False,
      skip_test=False,
      valid_datatype="valid",
      test_datatype="test",
  ):
      """
      Run through an evaluation loop.
  
      :param opt:
          Any non-default options you wish to set.
      :param bool skip_valid:
          If true skips the valid evaluation, and the first return value will be None.
      :param bool skip_test:
          If true skips the test evaluation, and the second return value will be None.
      :param str valid_datatype:
          If custom datatype required for valid, e.g. train:evalmode, specify here
  
      :return: (valid_results, test_results)
      :rtype: (dict, dict)
  
      If model_file is not in opt, then this helper will create a temporary directory
      to store the model files, and clean up afterwards. You can keep the directory
      by disabling autocleanup
      """
      import parlai.scripts.eval_model as ems
  
      if opt.get("model_file") and not opt.get("dict_file"):
          opt["dict_file"] = opt["model_file"] + ".dict"
  
      opt["datatype"] = (
          "valid" if valid_datatype is None else valid_datatype
      )
      valid = None if skip_valid else ems.EvalModel.main(**opt)
      opt["datatype"] = (
          "test" if test_datatype is None else test_datatype
      )
      test = None if skip_test else ems.EvalModel.main(**opt)
  
      return valid, test
  
imports: import os
  import unittest
  import contextlib
  import tempfile
  import shutil
  import io
  import signal
  from typing import Tuple, Dict, Any
  from parlai.core.opt import Opt
  import parlai.utils.logging
  from parlai.utils.io import PathManager
  from pytest_regressions.data_regression import DataRegressionFixture
label_desc: Use image node_id 22 for calling a global function with example usage: eval_model(opt, skip_valid, skip_test, valid_datatype, test_datatype) and returns: valid,  test