'Start downloading compressed data to Flash (performs an erase)
Returns number of blocks (size self.FLASH_WRITE_SIZE) to write.'

@stub_and_esp32_function_only
def flash_defl_begin(self, size, compsize, offset):

    num_blocks = (((compsize + self.FLASH_WRITE_SIZE) - 1) // self.FLASH_WRITE_SIZE)
    erase_blocks = (((size + self.FLASH_WRITE_SIZE) - 1) // self.FLASH_WRITE_SIZE)
    self._port.timeout = START_FLASH_TIMEOUT
    t = time.time()
    if self.IS_STUB:
        write_size = size
    else:
        write_size = (erase_blocks * self.FLASH_WRITE_SIZE)
    print(('Compressed    %d    bytes    to    %d...' % (size, compsize)))
    self.check_command('enter    compressed    flash    mode', self.ESP_FLASH_DEFL_BEGIN, struct.pack('<IIII', write_size, num_blocks, self.FLASH_WRITE_SIZE, offset))
    if ((size != 0) and (not self.IS_STUB)):
        print(('Took    %.2fs    to    erase    flash    block' % (time.time() - t)))
    self._port.timeout = DEFAULT_TIMEOUT
    return num_blocks
