def download_device(headers, cookies, temp_target_disk,<EOL>device_url, lease_updater,<EOL>total_bytes_written, total_bytes_to_write):
with open(temp_target_disk, '<STR_LIT:wb>') as handle:<EOL><INDENT>response = requests.get(device_url, stream=True,<EOL>headers=headers,<EOL>cookies=cookies, verify=False)<EOL>if not response.ok:<EOL><INDENT>response.raise_for_status()<EOL><DEDENT>current_bytes_written = <NUM_LIT:0><EOL>written_pct = <NUM_LIT:0><EOL>print("<STR_LIT>")<EOL>print("<STR_LIT>")<EOL>last_time = <NUM_LIT:0><EOL>for block in response.iter_content(chunk_size=<NUM_LIT>):<EOL><INDENT>if block:<EOL><INDENT>handle.write(block)<EOL>handle.flush()<EOL>os.fsync(handle.fileno())<EOL><DEDENT>prev_pct = written_pct<EOL>current_bytes_written += len(block)<EOL>if int(time.time()) > last_time + <NUM_LIT:3>:<EOL><INDENT>dl_in_mb = (total_bytes_written + current_bytes_written) /<NUM_LIT> /<NUM_LIT><EOL>last_time = int(time.time())<EOL><DEDENT>print(("<STR_LIT>".format(dl_in_mb)), end='<STR_LIT:U+0020>')<EOL><DEDENT><DEDENT>return current_bytes_written<EOL>
Download disk device of HttpNfcLease.info.deviceUrl
    list of devices
    :param headers: Request headers
    :type cookies: dict
    :param cookies: Request cookies (session)
    :type cookies: dict
    :param temp_target_disk: file name to write
    :type temp_target_disk: str
    :param device_url: deviceUrl.url
    :type device_url: str
    :param lease_updater:
    :type lease_updater: LeaseProgressUpdater
    :param total_bytes_written: Bytes written so far
    :type total_bytes_to_write: long
    :param total_bytes_to_write: VM unshared storage
    :type total_bytes_to_write: long
    :return: