code: def python_2_unicode_compatible(cls):
      
      if not PY3:
          cls.__unicode__ = cls.__str__
          cls.__str__ = lambda self: self.__unicode__().encode('utf-8')
      return cls
docs: A decorator that defines __unicode__ and __str__ methods under Python
      2. Under Python 3, this decorator is a no-op.
  
      To support Python 2 and 3 with a single code base, define a __str__
      method returning unicode text and apply this decorator to the class, like
      this::
  
      >>> from future.utils import python_2_unicode_compatible
  
      >>> @python_2_unicode_compatible
      ... class MyClass(object):
      ...     def __str__(self):
      ...         return u'Unicode string: \u5b54\u5b50'
  
      >>> a = MyClass()
  
      Then, after this import:
  
      >>> from future.builtins import str
  
      the following is ``True`` on both Python 3 and 2::
  
      >>> str(a) == a.encode('utf-8').decode('utf-8')
      True
  
      and, on a Unicode-enabled terminal with the right fonts, these both print the
      Chinese characters for Confucius::
  
      >>> print(a)
      >>> print(str(a))
  
      The implementation comes from django.utils.encoding.