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