'Returns a string with a HTML <table> for the given list,
where each item is a list of values.
With striped=True, generates <tr class="even|odd">.
With striped=True and headers, generates <td class="header[i]">.'

def table(self, rows=[], headers=[], striped=True, **attributes):

    h = list(headers)
    r = (list(rows) if (not h) else ([h] + list(rows)))
    a = [('<table%s>\n' % self._attrs(**attributes))]
    if h:
        a.append(' DCTB <colgroup>\n')
        a.extend(((' DCTB  DCTB <col    class="%s">\n' % v) for v in h))
        a.append(' DCTB </colgroup>\n')
    for (i, row) in enumerate(r):
        a.append((' DCTB <tr%s>\n' % (('    class="%s"' % ('odd', 'even')[(i % 2)]) if striped else '')))
        for (j, v) in enumerate(row):
            if ((i == 0) and h):
                a.append((' DCTB  DCTB <th>%s</th>\n' % v))
            else:
                a.append((' DCTB  DCTB <td>%s</td>\n' % v))
        a.append(' DCTB </tr>\n')
    a.append('</table>\n')
    return ''.join(a)
