def prt_bytes(num_bytes, human_flag):
 if (not human_flag):
  return ('%12s' % num_bytes)
 num = float(num_bytes)
 suffixes = ([None] + list('KMGTPEZY'))
 for suffix in suffixes[:(-1)]:
  if (num <= 1023):
   break
  num /= 1024.0
 else:
  suffix = suffixes[(-1)]
 if (not suffix):
  return ('%4s' % num_bytes)
 elif (num >= 10):
  return ('%3d%s' % (num, suffix))
 else:
  return ('%.1f%s' % (num, suffix))

def prt_bytes ( num_bytes , human_flag ) : if ( not human_flag ) : return ( '%12s' % num_bytes ) num = float ( num_bytes ) suffixes = ( [ None ] + list ( 'KMGTPEZY' ) ) for suffix in suffixes [ : ( - 1 ) ] : if ( num <= 1023 ) : break num /= 1024.0 else : suffix = suffixes [ ( - 1 ) ] if ( not suffix ) : return ( '%4s' % num_bytes ) elif ( num >= 10 ) : return ( '%3d%s' % ( num , suffix ) ) else : return ( '%.1f%s' % ( num , suffix ) )
convert a number > 1024 to printable format .