code: def _check_learner_states(self, framework, learner1, learner2):
      check(learner1.get_module_state(), learner2.get_module_state())
  
      # Method to call on the local optimizer object to get the optimizer's
      # state.
      method = "get_config" if framework == "tf2" else "state_dict"
  
      # check all internal optimizer state dictionaries have been updated
      learner_1_optims_serialized = {
          name: getattr(optim, method)()
          for name, optim in learner1._named_optimizers.items()
      }
      learner_2_optims_serialized = {
          name: getattr(optim, method)()
          for name, optim in learner2._named_optimizers.items()
      }
      check(learner_1_optims_serialized, learner_2_optims_serialized)
  
      learner_1_optims_serialized = [
          getattr(optim, method)()
          for optim in learner1._optimizer_parameters.keys()
      ]
      learner_2_optims_serialized = [
          getattr(optim, method)()
          for optim in learner2._optimizer_parameters.keys()
      ]
      check(learner_1_optims_serialized, learner_2_optims_serialized)
  
      check(learner1._module_optimizers, learner2._module_optimizers)
  
imports: import gymnasium
  import numpy
  import tempfile
  import unittest
  import ray
  from ray.rllib.core.learner.learner import Learner
  from ray.rllib.core.testing.testing_learner import BaseTestingAlgorithmConfig
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.test_utils import check, framework_iterator, get_cartpole_dataset_reader
  from ray.rllib.utils.metrics import ALL_MODULES
label_desc: Use image node_id 9 for calling the TestLearner obj's underlying member method code with example usage: obj._check_learner_states(framework, learner1, learner2) without return types