code: def train_and_validate(
      make_trial_controller_fn: Callable[
          [workload.Stream], det.TrialController
      ],
      steps: int = 2,
  ) -> Tuple[Sequence[Dict[str, Any]], Sequence[Dict[str, Any]]]:
      metrics: Dict[str, Any] = {"training": [], "validation": []}
  
      def make_workloads(steps: int) -> workload.Stream:
          trainer = TrainAndValidate()
  
          yield from trainer.send(
              steps, validation_freq=1, scheduling_unit=10
          )
          tm, vm = trainer.result()
          metrics["training"] += tm
          metrics["validation"] += vm
  
      controller = make_trial_controller_fn(make_workloads(steps))
      controller.run()
  
      return (metrics["training"], metrics["validation"])
  
imports: import importlib
  import os
  import pathlib
  import re
  import unittest.mock
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type
  import numpy
  import pytest
  from mypy_extensions import DefaultNamedArg
  import determined
  from determined import core, gpu, workload
  from determined.common import util
label_desc: Use image node_id 13 for calling a global function with example usage: train_and_validate(make_trial_controller_fn, steps) and returns: metrics,  metrics