def end(self, c):
        tdata = c.tableData
        data = tdata.get_data()

        # Add missing columns so that each row has the same count of columns
        # This prevents errors in Reportlab table

        try:
            maxcols = max([len(row) for row in data] or [0])
        except __HOLE__:
            log.warn(c.warning("<table> rows seem to be inconsistent"))
            maxcols = [0]

        for i, row in enumerate(data):
            data[i] += [''] * (maxcols - len(row))

        filter_len = filter(lambda col: col is None, tdata.colw)
        try:
            filter_len = len(filter_len)
        except Exception:
            filter_len = sum(1 for _ in filter_len)
        cols_with_no_width = filter_len
        if cols_with_no_width:  # any col width not defined
            bad_cols = filter(lambda tup: tup[1] is None, enumerate(tdata.colw))
            fair_division = str(100 / float(cols_with_no_width)) + '%' # get fair %
            for i, _ in bad_cols:
                tdata.colw[i] = fair_division   # fix empty with fair %

        try:
            if tdata.data:
                # log.debug("Table styles %r", tdata.styles)
                t = PmlTable(
                    data,
                    colWidths=tdata.colw,
                    rowHeights=tdata.rowh,
                    # totalWidth = tdata.width,
                    splitByRow=1,
                    # repeatCols = 1,
                    repeatRows=tdata.repeat,
                    hAlign=tdata.align,
                    vAlign='TOP',
                    style=TableStyle(tdata.styles))
                t.totalWidth = _width(tdata.width)
                t.spaceBefore = c.frag.spaceBefore
                t.spaceAfter = c.frag.spaceAfter

                # XXX Maybe we need to copy some more properties?
                t.keepWithNext = c.frag.keepWithNext
                # t.hAlign = tdata.align
                c.addStory(t)
            else:
                log.warn(c.warning("<table> is empty"))
        except:
            log.warn(c.warning("<table>"), exc_info=1)

        # Cleanup and re-swap table data
        c.clearFrag()
        c.tableData, self.tableData = self.tableData, None
dataset/ETHPy150Open xhtml2pdf/xhtml2pdf/xhtml2pdf/tables.py/pisaTagTABLE.end