docstr: Check if there is enough time to train the next model.
  
  Parameters
  ----------
  model_type : str
      String with type of the model.
  
  step: str
      String with name of the step in the process of AutoML training.
  
  
  Returns
  -------
  bool
      `True` if there is time for training next model, `False` otherwise.
docstr_tok: ["Check","if","there","is","enough","time","to","train","the","next","model",".","Parameters","--","--","--","--","--","model_type",":","str","String","with","type","of","the","model",".","step",":","str","String","with","name","of","the","step","in","the","process","of","AutoML","training",".","Returns","--","--","--","-","bool","`","True","`","if","there","is","time","for","training","next","model",",","`","False","`","otherwise","."]
code: def enough_time(self, model_type, step):
      """
      Check if there is enough time to train the next model.
  
      Parameters
      ----------
      model_type : str
          String with type of the model.
  
      step: str
          String with name of the step in the process of AutoML training.
  
  
      Returns
      -------
      bool
          `True` if there is time for training next model, `False` otherwise.
      """
      if step in ["ensemble", "ensemble_stacked"]:
          return True
      # if model_time_limit is set, train every model
      # do not apply total_time_limit
      if self._model_time_limit is not None:
          return True
      # no total time limit, just train, dont ask
      if self._total_time_limit is None:
          return True
  
      total_time_spend = time.time() - self._start_time
      time_left = self._total_time_limit - total_time_spend
      # no time left, do not train any more models, sorry ...
      if time_left < 0:
          # print("No time left", time_left)
          return False
  
      # check the fit level type
      # we dont want to spend too much time on one step
      if not self.enough_time_for_step(step):
          # print("Not enough time for step", step)
          return False
  
      # there is still time and model_type was not tested yet
      # we should try it
      if time_left > 0 and self.model_spend(model_type) == 0:
          return True
  
      # stacked models converge faster
      # dont need to check ...
      if step == "stack":
          return True
      # check if there is enough time for model to train
      return self.enough_time_for_model(model_type)
  
file_path: mljar-supervised/supervised/tuner/time_controller.py
imports: import json
  import logging
  import time
  import numpy
  import pandas
  from supervised.utils.config import LOG_LEVEL
label_desc: Use image node_id 9 for calling the TimeController obj's underlying member method code with example usage: obj.enough_time(model_type, step) and returns: self, True, True, True, False, False, True, True