def printTransferProgress(transferred, toBeTransferred, prefix = '', postfix='', isBytes=True):
    barLength = 20 # Modify this to change the length of the progress bar
    status = ""
    if toBeTransferred<0:
        defaultToBeTransferred = (barLength*1*MB)
        if transferred > defaultToBeTransferred:
            progress = float(transferred % defaultToBeTransferred) / defaultToBeTransferred
        else:
            progress = float(transferred) / defaultToBeTransferred
    elif toBeTransferred==0:  #There is nothing to be transferred
        progress = 1
        status = "Done...\n"
    else:
        progress = float(transferred) / toBeTransferred
        if progress >= 1:
            progress = 1
            status = "Done...\n"
    block = int(round(barLength*progress))
    nbytes = humanizeBytes(transferred) if isBytes else transferred
    if toBeTransferred>0:
        outOf = "/%s" % (humanizeBytes(toBeTransferred) if isBytes else toBeTransferred)
        percentage = "%4.2f%%"%(progress*100)
    else:
        outOf = ""
        percentage = ""
    text = "\r%s [%s]%s     %s%s %s %s    " % (prefix,
                                               "#"*block + "-"*(barLength-block),
                                               percentage,
                                               nbytes, outOf,
                                               postfix, status)
    sys.stdout.write(text)
    sys.stdout.flush()
Prints a progress bar
dataset/ETHPy150Open Sage-Bionetworks/synapsePythonClient/synapseclient/utils.py/printTransferProgress