def METHOD_NAME(self, event_type: str, fl_ctx: FLContext):
    if event_type == EventType.START_RUN:
        self.initialize(fl_ctx)
    elif event_type == EventType.ABORT_TASK:
        try:
            if self.learner:
                self.learner.abort(fl_ctx)
        except Exception as e:
            self.log_exception(fl_ctx, f"learner abort exception: {secure_format_exception(e)}")
    elif event_type == EventType.END_RUN:
        self.finalize(fl_ctx)