def serialize_message(message):
        """
        Serializes an object. It must subclass :class:`FranzEvent`.

        Parameters
        ----------
        message : FranzEvent
            The object to be serialized.

        Returns
        -------
        bytes
        """
        try:
            return bson.dumps(message.serialize())
        except bson.UnknownSerializerError:
            raise SerializationError(
                "Unable to serialize message: {}.".format(message)
            )
def serialize_message ( message ) : try : return bson . dumps ( message . serialize ( ) ) except bson . UnknownSerializerError : raise SerializationError ( "Unable to serialize message: {}." . format ( message ) )
Serializes an object. It must subclass :class:`FranzEvent`.

        Parameters
        ----------
        message : FranzEvent
            The object to be serialized.

        Returns
        -------
        bytes