class_docstr: Simple class to enforce a maximum threshold for the number of trials generated
  by a specific GenerationNode.
  
  Args:
      threshold: the designated maximum number of trials
      enforce: whether or not to enforce the max trial constraint
      only_in_status: optional argument for specifying only checking trials with
          this status. If not specified, all trial statuses are counted.
class_docstr_tok: ["Simple","class","to","enforce","a","maximum","threshold","for","the","number","of","trials","generated","by","a","specific","GenerationNode",".","Args",":","threshold",":","the","designated","maximum","number","of","trials","enforce",":","whether","or","not","to","enforce","the","max","trial","constraint","only_in_status",":","optional","argument","for","specifying","only","checking","trials","with","this","status",".","If","not","specified",",","all","trial","statuses","are","counted","."]
code: def __init__(
      self,
      threshold: int,
      only_in_statuses: Optional[List[TrialStatus]] = None,
      not_in_statuses: Optional[List[TrialStatus]] = None,
      transition_to: Optional[str] = None,
      block_transition_if_unmet: Optional[bool] = True,
      block_gen_if_met: Optional[bool] = False,
  ) -> None:
      super().__init__(
          threshold=threshold,
          only_in_statuses=only_in_statuses,
          not_in_statuses=not_in_statuses,
          transition_to=transition_to,
          block_gen_if_met=block_gen_if_met,
          block_transition_if_unmet=block_transition_if_unmet,
      )
  
imports: from abc import abstractmethod
  from logging import Logger
  from typing import List, Optional, Set
  from ax.core.base_trial import TrialStatus
  from ax.core.experiment import Experiment
  from ax.exceptions.generation_strategy import MaxParallelismReachedException
  from ax.modelbridge.generation_strategy import DataRequiredError
  from ax.utils.common.base import SortableBase
  from ax.utils.common.logger import get_logger
  from ax.utils.common.serialization import SerializationMixin, serialize_init_args
label_desc: Use image node_id 1 to create a new MaxTrials object from inherited base classes: TrialBasedCriterion with example: obj = MaxTrials(threshold, only_in_statuses, not_in_statuses, transition_to, block_transition_if_unmet, block_gen_if_met)