code: def unicode_compatible(cls):
      
      if PY3:
          cls.__str__ = cls.__unicode__
          cls.__bytes__ = lambda self: self.__str__().encode("utf-8")
      else:
          cls.__str__ = lambda self: self.__unicode__().encode("utf-8")
  
      return cls
docs: Decorator for unicode compatible classes. Method ``__unicode__``
      has to be implemented to work decorator as expected.