def statusBar(step, total, bar_len=<NUM_LIT:20>, onlyReturn=False):
norm = <NUM_LIT> / total<EOL>step *= norm<EOL>step = int(step)<EOL>increment = <NUM_LIT:100> // bar_len<EOL>n = step // increment<EOL>m = bar_len - n<EOL>text = "<STR_LIT>" + "<STR_LIT:=>" * n + "<STR_LIT:o>" + "<STR_LIT:->" * m + "<STR_LIT:]>" + str(step) + "<STR_LIT:%>"<EOL>if onlyReturn:<EOL><INDENT>return text<EOL><DEDENT>stdout.write(text)<EOL>stdout.flush()<EOL>
print a ASCI-art statusbar of variable length e.g.showing 25%:

>>> step = 25
>>> total = 100

>>> print( statusBar(step, total, bar_len=20, onlyReturn=True) )
\r[=====o---------------]25%

as default onlyReturn is set to False
in this case the last printed line would be flushed every time when
the statusbar is called to create a the effect of one moving bar