code: def cancel(self):
          
          if not self.__submitted:
              # XXX: Workaround for a bug reported on libusb 1.0.8: calling
              # libusb_cancel_transfer on a non-submitted transfer might
              # trigger a segfault.
              raise self.__USBErrorNotFound
          self.__mayRaiseUSBError(self.__libusb_cancel_transfer(self.__transfer))
docs: Cancel transfer.
          Note: cancellation happens asynchronously, so you must wait for
          TRANSFER_CANCELLED.