#NEWLINE# def humanizeBytes( bytes ) : #NEWLINE# #INDENT# bytes = float ( bytes ) #NEWLINE# units = [ 'bytes' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' ] #NEWLINE# for ( i , unit ) in enumerate ( units ) : #NEWLINE# #INDENT# if ( bytes < 1024 ) : #NEWLINE# #INDENT# return ( '%3.1f%s' % ( bytes , units [ i ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bytes /= 1024 #NEWLINE# #UNINDENT# #UNINDENT# return 'Oops larger than Exabytes'