  """
  from django.db import models
  from django.db.models.query import QuerySet
  from django.db.models.fields.related import RelatedField
  from django.utils.encoding import smart_unicode, is_protected_type
  
  import decimal
  import inspect
  import types
  
 
</s> remove         return getattr(self.rename, key, key)
 </s> add         return getattr(self.rename, smart_str(key), smart_str(key)) </s> remove             elif hasattr(instance, fname):
 </s> add             elif hasattr(instance, smart_str(fname)): </s> remove             if hasattr(self, fname):
 </s> add             if hasattr(self, smart_str(fname)): </s> remove     source ./env/bin/activate
 </s> add     source env/bin/activate
from django.utils.encoding import smart_unicode, is_protected_type, smart_str
  """
  from django.db import models
  from django.db.models.query import QuerySet
  from django.db.models.fields.related import RelatedField
from django.utils.encoding import smart_unicode, is_protected_type, smart_str
  
  import decimal
  import inspect
  import types
  
keep keep keep keep replace keep keep keep keep keep
 Fix bitbucket issue 39.  All further issues should be on github 
djangorestframework/serializer.py