code: def test_optimizer_state(
      self, tmp_path: Path, xor_trial_controller: Callable
  ) -> None:
      def make_trial_controller_fn(
          workloads: workload.Stream,
          checkpoint_dir: Optional[str] = None,
          latest_checkpoint: Optional[Dict[str, Any]] = None,
          steps_completed: int = 0,
      ) -> det.TrialController:
          return xor_trial_controller(
              self.hparams,
              workloads,
              scheduling_unit=100,
              trial_seed=self.trial_seed,
              checkpoint_dir=checkpoint_dir,
              latest_checkpoint=latest_checkpoint,
              steps_completed=steps_completed,
          )
  
      utils.checkpointing_and_restoring_test(
          make_trial_controller_fn, tmp_path
      )
  
imports: import os
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional
  import pytest
  import tensorflow
  from packaging import version
  import determined
  from determined import keras, workload
  from tests.experiment import utils
  from tests.experiment.fixtures import tf_keras_xor_model
label_desc: Use image node_id 8 for calling the TestKerasTrial obj's underlying member method code with example usage: obj.test_optimizer_state(tmp_path, xor_trial_controller) and returns: xor_trial_controller