  else:
      try:
          from django.contrib.auth.models import User
      except ImportError:
          raise ImportError(u"User model is not to be found.")
  
  
  # First implementation of Django class-based views did not include head method
  # in base View class - https://code.djangoproject.com/ticket/15668
  if django.VERSION >= (1, 4):
 
</s> remove                     raise TypeError(u"You tried to pass in the %s method name as a "
                                    u"keyword argument to %s(). Don't do that."
 </s> add                     raise TypeError("You tried to pass in the %s method name as a "
                                    "keyword argument to %s(). Don't do that." </s> remove     import StringIO
 </s> add     from six import StringIO </s> remove                     raise TypeError(u"%s() received an invalid keyword %r" % (
 </s> add                     raise TypeError("%s() received an invalid keyword %r" % ( </s> remove             msg = "Invalid pk '%s' - object does not exist." % smart_unicode(data)
 </s> add             msg = "Invalid pk '%s' - object does not exist." % smart_text(data) </s> remove from django.utils.encoding import smart_unicode, DjangoUnicodeDecodeError
 </s> add from django.utils.encoding import DjangoUnicodeDecodeError
try:
    from django.utils.encoding import smart_text
except ImportError:
    from django.utils.encoding import smart_unicode as smart_text
        raise ImportError("User model is not to be found.")
  else:
      try:
          from django.contrib.auth.models import User
      except ImportError:
        raise ImportError("User model is not to be found.")
  
  
  # First implementation of Django class-based views did not include head method
  # in base View class - https://code.djangoproject.com/ticket/15668
  if django.VERSION >= (1, 4):
keep keep keep keep replace keep keep keep keep keep
 First passing test under p3k \o/ 
rest_framework/compat.py