'Parses a TR element and converts it into a format for ReportLab
@param html: the TR element  to convert
@param style: the default style
@param rowCnt: the row counter
@param rowspans: the remaining rowspans (if any)
@return: a list containing text that ReportLab can use'

def parse_tr(self, html, style, rowCnt, rowspans):

    row_styles = self._styles(html)
    background = self._color(row_styles.get('background-color'))
    color = self._color(row_styles.get('color'))
    row = []
    rappend = row.append
    sappend = style.append
    select_tag = self.select_tag
    font_name_bold = self.font_name_bold
    exclude_tag = self.exclude_tag
    colCnt = 0
    rspan_index = (-1)
    for component in html.components:
        if ((not isinstance(component, (TH, TD))) or exclude_tag(component)):
            continue
        rspan_index += 1
        if (len(rowspans) < (rspan_index + 1)):
            rowspans.append(0)
        if rowspans[rspan_index]:
            rappend('')
            rowspans[rspan_index] -= 1
            cell = (colCnt, rowCnt)
            sappend(('LINEABOVE', cell, cell, 0, colors.white))
            colCnt += 1
        if (component.components == []):
            rappend('')
            continue
        rowspan = component.attributes.get('_rowspan')
        if rowspan:
            rowspans[rspan_index] = (rowspan - 1)
        colspan = component.attributes.get('_colspan', 1)
        for detail in component.components:
            if color:
                self.normalstyle.textColor = color
            else:
                self.normalstyle.textColor = colors.black
            result = select_tag(detail, title=isinstance(component, TH))
            if (result is None):
                continue
            rappend(result)
            cell = (colCnt, rowCnt)
            if color:
                sappend(('TEXTCOLOR', cell, cell, color))
            if background:
                sappend(('BACKGROUND', cell, cell, background))
            elif isinstance(component, TH):
                sappend(('BACKGROUND', cell, cell, colors.lightgrey))
                sappend(('FONTNAME', cell, cell, font_name_bold))
            if (colspan > 1):
                for i in xrange(1, colspan):
                    rappend('')
                sappend(('SPAN', cell, (((colCnt + colspan) - 1), rowCnt)))
                colCnt += colspan
            else:
                colCnt += 1
    if (row == []):
        return None
    else:
        return row
