    def to_html_table(data, headers):
        """Convert two dimensional data structure into html table

        Args:
            data (List)
            headers (Iterable[str]): The names of columns defined by user.
        Returns:
            str: The table in html format.
        """
        tb_style = 'style="border-collapse: collapse;"'
        th_style = 'style="text-align: center; font-size: 130%; border: none;"'
        trs = []
        trs.append('<tr>' + ' '.join(['<th ' + th_style + '>' + x + '</th>' for x in headers]) + '</tr>')

        for r in data:
            tds = []
            for x in r:
                if isinstance(x, dict) and 'headers' in x and 'data' in x:
                    tds.append('<td>' + NestedHTMLTable.to_html_table(x['data'], x['headers']) + '</td>')
                else:
                    tds.append(_to_html_td(x))

            trs.append(
                '<tr>' + ''.join(tds) + '</tr>'
            )
        return '<table ' + tb_style + '>' + '\n'.join(trs) + '</table>'
Convert two dimensional data structure into html table

Args:
data (List)
headers (Iterable[str]): The names of columns defined by user.
Returns:
str: The table in html format.
towhee/utils/html_table.py