def reporthook(count, block_size, total_size):
    global _start_time, _last_time
    cur_time = int(time.time())
    if (count == 0):
        _start_time = cur_time
        _last_time = cur_time
        return
    if (cur_time == _last_time):
        return
    _last_time = cur_time
    duration = (cur_time - _start_time)
    progress_size = int((count * block_size))
    speed = int((progress_size / (1024 * duration)))
    percent = int((((count * block_size) * 100) / total_size))
    time_left = (((total_size - progress_size) / speed) / 1024)
    sys.stdout.write(('\r...%d%%, %d MB, %d KB/s, %d seconds left...   ' % (percent, (progress_size / (1024 * 1024)), speed, time_left)))
    sys.stdout.flush()
def reporthook(count, block_size, total_size):
    global _start_time, _last_time
    cur_time = int(time.time())
    if (count == 0):
        _start_time = cur_time
        _last_time = cur_time
        return
    if (cur_time == _last_time):
        return
    _last_time = cur_time
    duration = (cur_time - _start_time)
    progress_size = int((count * block_size))
    speed = int((progress_size / (1024 * duration)))
    percent = int((((count * block_size) * 100) / total_size))
    time_left = (((total_size - progress_size) / speed) / 1024)
    sys.stdout.write(('\r...%d%%, %d MB, %d KB/s, %d seconds left...   ' % (percent, (progress_size / (1024 * 1024)), speed, time_left)))
    sys.stdout.flush()