def get_status_string(downloaded, total):
    """Return a string showing the current progress"""
    if _stash is not None and hasattr(_stash, "libcore"):
        hdr = _stash.libcore.sizeof_fmt(downloaded)
    else:
        hdr = "%10d" % downloaded
    if total:
        total = float(total)
        percent = min((downloaded / total) * 100.0, 100.0)
        total_c = 20
        nc = int(total_c * (downloaded / total))
        sh = ">" if downloaded != total else "="
        bar = "[" + "=" * (nc - 1) + sh + " " * (total_c - nc) + "]"
        # status = r"%10d  [%3.2f%%]" % downloaded, percent
        status = r"%s %3.2f%% | %s" % (bar, percent, hdr)
    else:
        status = hdr
    return status
Return a string showing the current progress
bin/wget.py