def convert_bytes(bytes):
 if (bytes is None):
  bytes = 0
 bytes = float(bytes)
 if (bytes >= 1099511627776):
  terabytes = (bytes / 1099511627776)
  size = ('%.2fTB' % terabytes)
 elif (bytes >= 1073741824):
  gigabytes = (bytes / 1073741824)
  size = ('%.2fGB' % gigabytes)
 elif (bytes >= 1048576):
  megabytes = (bytes / 1048576)
  size = ('%.2fMB' % megabytes)
 elif (bytes >= 1024):
  kilobytes = (bytes / 1024)
  size = ('%.2fKB' % kilobytes)
 else:
  size = ('%.2fb' % bytes)
 return size

def convert_bytes ( bytes ) : if ( bytes is None ) : bytes = 0 bytes = float ( bytes ) if ( bytes >= 1099511627776 ) : terabytes = ( bytes / 1099511627776 ) size = ( '%.2fTB' % terabytes ) elif ( bytes >= 1073741824 ) : gigabytes = ( bytes / 1073741824 ) size = ( '%.2fGB' % gigabytes ) elif ( bytes >= 1048576 ) : megabytes = ( bytes / 1048576 ) size = ( '%.2fMB' % megabytes ) elif ( bytes >= 1024 ) : kilobytes = ( bytes / 1024 ) size = ( '%.2fKB' % kilobytes ) else : size = ( '%.2fb' % bytes ) return size
returns given bytes as prettified string .