def _repr_html_(self):
        html_lines = ['<table class="table">']
        html_lines.append(self.caption._repr_html_  ())
        html_lines.append('<thead>')
        for hrow in self.headings:
            html_lines.append('<tr>')
            for cell in hrow:
                html_lines.append('<th>' + cell.text + '</th>')
        html_lines.append('</thead>')
        html_lines.append('<tbody>')
        for row in self.rows:
            html_lines.append('<tr>')
            for cell in row:
                html_lines.append('<td>' + cell.text + '</td>')
        html_lines.append('</tbody>')
        html_lines.append('</table>')
        return '\n'.join(html_lines)