def byte_number_string(<EOL>number, thousandsSep=True, partition=False, base1024=True, appendBytes=True<EOL>):
magsuffix = "<STR_LIT>"<EOL>bytesuffix = "<STR_LIT>"<EOL>if partition:<EOL><INDENT>magnitude = <NUM_LIT:0><EOL>if base1024:<EOL><INDENT>while number >= <NUM_LIT>:<EOL><INDENT>magnitude += <NUM_LIT:1><EOL>number = number >> <NUM_LIT:10><EOL><DEDENT><DEDENT>else:<EOL><INDENT>while number >= <NUM_LIT:1000>:<EOL><INDENT>magnitude += <NUM_LIT:1><EOL>number /= <NUM_LIT><EOL><DEDENT><DEDENT>magsuffix = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT:M>", "<STR_LIT>", "<STR_LIT:T>", "<STR_LIT:P>"][magnitude]<EOL><DEDENT>if appendBytes:<EOL><INDENT>if number == <NUM_LIT:1>:<EOL><INDENT>bytesuffix = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>bytesuffix = "<STR_LIT>"<EOL><DEDENT><DEDENT>if thousandsSep and (number >= <NUM_LIT:1000> or magsuffix):<EOL><INDENT>snum = "<STR_LIT>".format(number)<EOL><DEDENT>else:<EOL><INDENT>snum = str(number)<EOL><DEDENT>return "<STR_LIT>".format(snum, magsuffix, bytesuffix)<EOL>
Convert bytes into human-readable representation.