code: def _try_run(self, run_func: Callable[[], None]) -> None:
          
          # Initialization: before_training
          for hook in self._hooks:
              hook.before_training()
  
          try:
              run_func()
          except TrainingTerminated as ex:
              logging.info('Training terminated: %s', ex)
  
          # After training: after_training
          for hook in self._hooks:
              hook.after_training()
docs: Try running the given function (training/prediction).
  
          Calls
              - :py:meth:`cxflow.hooks.AbstractHook.before_training`
              - :py:meth:`cxflow.hooks.AbstractHook.after_training`
  
          :param run_func: function to be run