code: def to_dict(self):
          
          return {
              'type': self.__class__.__name__,
              'element_id': self.element_id,
              'style_class': self.style_class,
              'icon': self.icon,
              'attributes': self.attributes
          }
docs: Render a MessageElement as python dict.
  
          :return: Python dict representation
          :rtype: dict