code: def _check_periodic_pipeline(self, gen):
          
          self._update_top_pipeline()
          if self.periodic_checkpoint_folder is not None:
              total_since_last_pipeline_save = (datetime.now() - self._last_pipeline_write).total_seconds()
              if total_since_last_pipeline_save > self._output_best_pipeline_period_seconds:
                  self._last_pipeline_write = datetime.now()
                  self._save_periodic_pipeline(gen)
  
          if self.early_stop is not None:
              if self._last_optimized_pareto_front_n_gens >= self.early_stop:
                  raise StopIteration("The optimized pipeline was not improved after evaluating {} more generations. "
                                      "Will end the optimization process.\n".format(self.early_stop))
docs: If enough time has passed, save a new optimized pipeline. Currently used in the per generation hook in the optimization loop.
          Parameters
          ----------
          gen: int
              Generation number
  
          Returns
          -------
          None