code: def save_model(model: AbstractModel, name_suffix: str, on_failure: str) -> None:
          
          try:
              logging.debug('Saving the model')
              save_path = model.save(name_suffix)
              logging.info('Model saved to: %s', save_path)
          except Exception as ex:  # pylint: disable=broad-except
              if on_failure == 'error':
                  raise IOError('Failed to save the model.') from ex
              elif on_failure == 'warn':
                  logging.warning('Failed to save the model.')
docs: Save the given model with the given name_suffix. On failure, take the specified action.
  
          :param model: the model to be saved
          :param name_suffix: name to be used for saving
          :param on_failure: action to be taken on failure; one of :py:attr:`SAVE_FAILURE_ACTIONS`
          :raise IOError: on save failure with ``on_failure`` set to ``error``