old_contents: from django.utils import simplejson
  from django.http import HttpResponse
  
  
  def json_response(func):
      """
      A decorator thats takes a view response and turns it
      into json. If a callback is added through GET or POST
      the response is JSONP.
      """
      def decorator(request, *args, **kwargs):
          objects = func(request, *args, **kwargs)
          if isinstance(objects, HttpResponse):
              return objects
          data = simplejson.dumps(objects)
          return HttpResponse(data, "application/json")
      return decorator
  
  
  def bytes2human(n):
      # http://code.activestate.com/recipes/578019
      # >>> bytes2human(10000)
      # '9.8K'
      # >>> bytes2human(100001221)
      # '95.4M'
      symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
      prefix = {}
      for i, s in enumerate(symbols):
          prefix[s] = 1 << (i+1)*10
      for s in reversed(symbols):
          if n >= prefix[s]:
              value = float(n) / prefix[s]
              return '%.1f%s' % (value, s)
      return "%sB" % n
  
  
  def to_meg(n):
      return str(int(n / 1024 / 1024))
  
new_contents: import json as simplejson
  from django.http import HttpResponse
  
  
  def json_response(func):
      """
      A decorator thats takes a view response and turns it
      into json. If a callback is added through GET or POST
      the response is JSONP.
      """
      def decorator(request, *args, **kwargs):
          objects = func(request, *args, **kwargs)
          if isinstance(objects, HttpResponse):
              return objects
          data = simplejson.dumps(objects)
          return HttpResponse(data, "application/json")
      return decorator
  
  
  def bytes2human(n):
      # http://code.activestate.com/recipes/578019
      # >>> bytes2human(10000)
      # '9.8K'
      # >>> bytes2human(100001221)
      # '95.4M'
      symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
      prefix = {}
      for i, s in enumerate(symbols):
          prefix[s] = 1 << (i+1)*10
      for s in reversed(symbols):
          if n >= prefix[s]:
              value = float(n) / prefix[s]
              return '%.1f%s' % (value, s)
      return "%sB" % n
  
  
  def to_meg(n):
      return str(int(n / 1024 / 1024))
  
subject: Update utils.py