def METHOD_NAME(self, session):
    self._spark_events.emit_statement_execution_start_event(
        session.guid, session.kind, session.id, self.guid
    )
    statement_id = -1
    try:
        session.wait_for_idle()
        data = {"code": self.code}
        response = session.http_client.post_statement(session.id, data)
        statement_id = response["id"]
        output = self._get_statement_output(session, statement_id)
    except KeyboardInterrupt as e:
        self._spark_events.emit_statement_execution_end_event(
            session.guid,
            session.kind,
            session.id,
            self.guid,
            statement_id,
            False,
            e.__class__.__name__,
            str(e),
        )
        try:
            if statement_id >= 0:
                response = session.http_client.cancel_statement(
                    session.id, statement_id
                )
                session.wait_for_idle()
        except:
            raise SparkStatementCancellationFailedException(
                COMMAND_CANCELLATION_FAILED_MSG
            )
        else:
            raise SparkStatementCancelledException(COMMAND_INTERRUPTED_MSG)
    except Exception as e:
        self._spark_events.emit_statement_execution_end_event(
            session.guid,
            session.kind,
            session.id,
            self.guid,
            statement_id,
            False,
            e.__class__.__name__,
            str(e),
        )
        raise
    else:
        self._spark_events.emit_statement_execution_end_event(
            session.guid,
            session.kind,
            session.id,
            self.guid,
            statement_id,
            True,
            "",
            "",
        )
        return output