<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cancel(self):
 """ Cancel current statement """

        conn = self._assert_open()
        conn._try_activate_cursor(self)
        self._session.cancel_if_pending()