def update_progress(progress, total_size):
    '''prints a progress bar, with percentages, and auto-cr so always printed in same line
    @param progress: percentage, float
    @param total_size: file total size in Mb
    '''
    bar_length = 40
    status = ""
    if progress < 0:
        progress = 0
        status = "Halt...\r\n"
    if progress >= 1:
        progress = 1
        status = "Done...\r\n"
    block = int(round(bar_length * progress))
    text = "\rPercent: [{0}] {1:.1f}% of {2:.1f}Mb {3}".format("#" * block +
                                                               "-" * (bar_length - block),
                                                               progress * 100, total_size, status)
    sys.stdout.write(text)
    sys.stdout.flush()
dataset/ETHPy150Open biicode/client/setups/setup_tools.py/update_progress/original