class_docstr: Stop the training once a threshold in episodic reward
  has been reached (i.e. when the model is good enough).
  
  It must be used with the `EvalCallback`.
  
  :param reward_threshold: (float)  Minimum expected reward per episode
      to stop training.
  :param verbose: (int)
class_docstr_tok: ["Stop","the","training","once","a","threshold","in","episodic","reward","has","been","reached","(","i.e",".","when","the","model","is","good","enough",")",".","It","must","be","used","with","the","`","EvalCallback","`",".",":","param","reward_threshold",":","(","float",")","Minimum","expected","reward","per","episode","to","stop","training",".",":","param","verbose",":","(","int",")"]
code: def _on_step(self) -> bool:
      assert self.parent is not None, (
          "`StopTrainingOnRewardThreshold` callback must be used "
          "with an `EvalCallback`"
      )
      # Convert np.bool to bool, otherwise callback.on_step() is False won't work
      continue_training = bool(
          self.parent.best_mean_reward < self.reward_threshold
      )
      if self.verbose > 0 and not continue_training:
          print(
              "Stopping training because the mean reward {:.2f} "
              " is above the threshold {}".format(
                  self.parent.best_mean_reward, self.reward_threshold
              )
          )
      return continue_training
  
imports: import os
  from abc import ABC
  import warnings
  import typing
  from typing import Union, List, Dict, Any, Optional
  import gym
  import numpy
  from stable_baselines.common.vec_env import VecEnv, sync_envs_normalization, DummyVecEnv
  from stable_baselines.common.evaluation import evaluate_policy
  from stable_baselines import logger
label_desc: Use image node_id 2 for calling the StopTrainingOnRewardThreshold obj's underlying member method code with example usage: obj._on_step() and returns: continue_training