def format_filesize(size):
 for suffix in ('bytes', 'KB', 'MB', 'GB', 'TB'):
  if (size < 1024.0):
   if (suffix in ('GB', 'TB')):
    return '{0:3.2f} {1}'.format(size, suffix)
   else:
    return '{0:3.1f} {1}'.format(size, suffix)
  size /= 1024.0

def format_filesize ( size ) : for suffix in ( 'bytes' , 'KB' , 'MB' , 'GB' , 'TB' ) : if ( size < 1024.0 ) : if ( suffix in ( 'GB' , 'TB' ) ) : return '{0:3.2f} {1}' . format ( size , suffix ) else : return '{0:3.1f} {1}' . format ( size , suffix ) size /= 1024.0
formats the file size into a human readable format .