code: def cancel_if_pending(self):
          
          if self.state == tds_base.TDS_IDLE:
              return
          if not self.in_cancel:
              self.put_cancel()
          self.process_cancel()
docs: Cancels current pending request.
  
          Does nothing if no request is pending, otherwise sends cancel request,
          and waits for response.