def formatSize(size):
 size = int(size)
 steps = 0
 sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB']
 while (size > 1000):
  size /= 1024.0
  steps += 1
 return ('%.2f %s' % (size, sizes[steps]))

def formatSize ( size ) : size = int ( size ) steps = 0 sizes = [ 'B' , 'KiB' , 'MiB' , 'GiB' , 'TiB' ] while ( size > 1000 ) : size /= 1024.0 steps += 1 return ( '%.2f %s' % ( size , sizes [ steps ] ) )
formats size of bytes .