#NEWLINE# def size( bytes , system = byte ) : #NEWLINE# #INDENT# '\n    Human-readable file size.\n    ' #NEWLINE# for ( factor , suffix ) in system : #NEWLINE# #INDENT# if ( bytes >= factor ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# amount = ( bytes / factor ) #NEWLINE# if isinstance ( suffix , tuple ) : #NEWLINE# #INDENT# ( singular , multiple ) = suffix #NEWLINE# if ( amount == 1 ) : #NEWLINE# #INDENT# suffix = singular #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suffix = multiple #NEWLINE# #UNINDENT# #UNINDENT# if ( type ( amount ) == float ) : #NEWLINE# #INDENT# return ( '%0.3f%s' % ( amount , suffix ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( str ( amount ) + suffix )