code: def __call__(
      self, study: optuna.study.Study, trial: optuna.trial.FrozenTrial
  ) -> None:
      if trial.state == optuna.trial.TrialState.PRUNED:
          self._consequtive_pruned_count += 1
      else:
          self._consequtive_pruned_count = 0
  
      if self._consequtive_pruned_count >= self.threshold:
          study.stop()
  
imports: import optuna
  import logging
  import sys
label_desc: Use image node_id 2 for calling the StopWhenTrialKeepBeingPrunedCallback obj's underlying member method code with example usage: obj.__call__(study, trial) without return types