code: def __save_checkpoint(self):
      if (
          int(self.config["checkpoint_interval"]) >= 1
          and self.gen % int(self.config["checkpoint_interval"]) == 0
      ) or self.stop():
          try:
              result_dir = os.path.abspath(
                  os.path.expanduser(self.config["result_dir"])
              )
              if not os.path.exists(result_dir):
                  os.makedirs(result_dir)
          except BaseException:
              self.looger.warn(
                  "Cannot retrieve checkpoint directory,"
                  " not saving checkpoint"
              )
              return
  
          checkpoint_file = os.path.join(
              result_dir,
              "G%s_F%s_checkpoint.pkl" % (self.gen, self.best_fitness),
          )
          with open(checkpoint_file, "wb") as f:
              copy_of_self = copy.copy(self)
              copy_of_self.logger = None
              copy_of_self.config = None
              # copy_of_self.es = None
              pickle.dump(copy_of_self, f, protocol=-1)
  
          best_file = os.path.join(
              result_dir,
              "G%s_F%s_best.pkl" % (self.gen, self.best_fitness),
          )
          with open(best_file, "wb") as f:
              pickle.dump(self.best, f, protocol=-1)
  
          with open(os.path.join(result_dir, "fitness.txt"), "wb") as f:
              for best, mean in zip(
                  self.best_fitnesses, self.mean_fitnesses
              ):
                  f.write("%s %s\n" % (best, mean))
  
          self.logger.info(
              "Saved checkpoint to file: %s" % checkpoint_file
          )
  
imports: import cma
  import random
  import copy
  import pickle
  import os
  import pprint
  import time
  import six
  import numpy
  from opt_util import EPSILON
label_desc: Use image node_id 10 for calling the Optimizer obj's underlying member method code with example usage: obj.__save_checkpoint() without return types