code: def serializeAttributes(self, msg):
          
          attributes = self.getAttributes()
          for key in attributes:
              protocol.setAttribute(
                  msg.attributes.attr[key].values, attributes[key])
          return msg
docs: Sets the attrbutes of a message during serialization.