from boto.s3.connection import S3Connection
from django.conf import settings

class S3Mixin(object):
    def get_bucket(self):
        if not hasattr(self, 'bucket'):
            conn = S3Connection(settings.AWS_ACCESS_KEY_ID, settings.AWS_SECRET_ACCESS_KEY)
            self.bucket = conn.get_bucket(settings.REMOTE_FIXTURE_BUCKET)

        return self.bucket


def humanize_filesize(bytes):
    for x in [' bytes','KB','MB','GB']:
        if bytes == 0:
            return '0 bytes'
        if bytes < 1024.0 and bytes > -1024.0:
            return "%3.1f%s" % (bytes, x)
        bytes /= 1024.0
    return "%3.1f%s" % (bytes, 'TB')

@@ -382,17 +382,22 @@
 ize(byte
-s
+_count
 ):%0A    f
@@ -446,17 +446,22 @@
  if byte
-s
+_count
  == 0:%0A 
@@ -503,17 +503,22 @@
  if byte
-s
+_count
  %3C 1024.
@@ -527,17 +527,22 @@
 and byte
-s
+_count
  %3E -1024
@@ -581,17 +581,22 @@
  %25 (byte
-s
+_count
 , x)%0A   
@@ -604,17 +604,22 @@
     byte
-s
+_count
  /= 1024
@@ -649,17 +649,22 @@
  %25 (byte
-s
+_count
 , 'TB')%0A

change bytes to byte_count