Python 3 compatibility for json serializer

Does this actually solve the problem? IIRC, you want to apply your transformation to the return of `_json.dumps`, which would be `func(message)`. How about something like:

    serialized = func(message)
    if not isinstance(serialized, bytes):
        serialized = serialized.encode('utf-8')
    return fernet.encrypt(serialized)