A decorator that defines ``__str__`` and ``__unicode__`` methods
    under Python 2.

def unicode_compatible(cls):
    """
    A decorator that defines ``__str__`` and ``__unicode__`` methods
    under Python 2.
    """
    if not is_py3:
        cls.__unicode__ = cls.__str__
        cls.__str__ = lambda self: self.__unicode__().encode('utf-8')
    return cls