<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_html(self):
 """Render a Table MessageElement as html. :returns: The html representation of the Table MessageElement :rtype: basestring """

        table = '<table%s>\n' % self.html_attributes()
        if self.caption is not None:
            if isinstance(self.caption, MessageElement):
                caption = self.caption.to_html()
            else:
                caption = self.caption
            table += '<caption>%s</caption>\n' % caption
        if self.header:
            if isinstance(self.header, MessageElement):
                header = self.header.to_html()
            else:
                header = self.header
            table += '<thead>%s</thead>' % header
        table += '<tbody>\n'
        for row in self.rows:
            table += row.to_html()
        table += '</tbody>\n</table>\n'

        return table