def register_kombu_serializers():
    """
    Register our custom pickle serializer which knows how to handle UTF-8 (non
    ascii) messages.

    Default kombu pickle de-serializer calls .encode() on the bytes object without providing an
    encoding. This means it default to "ascii" and fail with UnicodeDecode error.

    https://github.com/celery/kombu/blob/3.0/kombu/utils/encoding.py#L47
    """

    def pickle_dumps(obj, dumper=pickle.dumps):
        return dumper(obj, protocol=pickle_protocol)

    if six.PY3:

        def str_to_bytes(s):
            if isinstance(s, str):
                return s.encode("utf-8")
            return s

        def unpickle(s):
            return pickle_loads(str_to_bytes(s))

    else:

        def str_to_bytes(s):  # noqa
            if isinstance(s, unicode):  # noqa  # pylint: disable=E0602
                return s.encode("utf-8")
            return s

        unpickle = pickle_loads  # noqa

    register(
        "pickle",
        pickle_dumps,
        unpickle,
        content_type="application/x-python-serialize",
        content_encoding="binary",
    )

    Register our custom pickle serializer which knows how to handle UTF-8 (non
    ascii) messages.

    Default kombu pickle de-serializer calls .encode() on the bytes object without providing an
    encoding. This means it default to "ascii" and fail with UnicodeDecode error.

    https://github.com/celery/kombu/blob/3.0/kombu/utils/encoding.py#L47
    
st2common/st2common/transport/bootstrap_utils.py