def ExpectDownload(self, writes, succeed=True, accept_data=True):
    self.usb.ExpectWrite('download:%08x' % self._SumLengths(writes))

    if accept_data:
      self.usb.ExpectRead('DATA%08x' % self._SumLengths(writes))
    else:
      self.usb.ExpectRead('DATA%08x' % (self._SumLengths(writes) - 2))

    for data in writes:
      self.usb.ExpectWrite(data)

    if succeed:
      self.usb.ExpectRead('OKAYResult')
    else:
      self.usb.ExpectRead('FAILResult')
dataset/ETHPy150Open google/python-adb/test/fastboot_test.py/FastbootTest.ExpectDownload/original