def python_2_unicode_compatible(klass):
    if not PY3:
        klass.__unicode__ = klass.__str__
        klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
    return klass
Decorators: keep_messages should not break when there's no flash scope attached to the request.
dataset/ETHPy150Open sebleier/django-redis-cache/redis_cache/compat.py/python_2_unicode_compatible--crossover with--dataset/ETHPy150Open danielfm/django-flash/src/djangoflash/tests/decorators.py/KeepMessagesDecoratorTestCase.test_decorator_with_no_flash