def hr_size(num, suffix='<STR_LIT:B>') -> str:
for unit in '<STR_LIT>':<EOL><INDENT>if abs(num) < <NUM_LIT>:<EOL><INDENT>return "<STR_LIT>" % (num, unit if unit != '<STR_LIT:U+0020>' else '<STR_LIT>', suffix)<EOL><DEDENT>num /= <NUM_LIT><EOL><DEDENT>return "<STR_LIT>" % (num, '<STR_LIT:Y>', suffix)<EOL>
Human-readable data size
From https://stackoverflow.com/a/1094933
:param num: number of bytes
:param suffix: Optional size specifier
:return: Formatted string