code: def to_html(
              self,
              suppress_newlines=False,
              in_div_flag=False):  # pylint: disable=W0221
          
  
          if in_div_flag or self.in_div_flag:
              message = '<div %s>' % self.html_attributes()
          else:
              message = ''
  
          last_was_text = False
          for m in self.message:
              if last_was_text and not isinstance(m, Text):
                  message += '\n'
  
              message += m.to_html()
  
              if isinstance(m, Text):
                  last_was_text = True
              else:
                  message += '\n'
                  last_was_text = False
  
          if in_div_flag:
              message += '</div>'
  
          if suppress_newlines:
              return message.replace('\n', '')
          return message
docs: Render a MessageElement as html.
  
          :param suppress_newlines: Whether to suppress any newlines in the
              output. If this option is enabled, the entire html output will be
              rendered on a single line.
          :type suppress_newlines: bool
  
          :param in_div_flag: Whether the message should be placed into an outer
              div element.
          :type in_div_flag: bool
  
          :returns: HTML representation of the message.
          :rtype: str