def _expand_colspan_rowspan(self, rows):
all_texts = []  <EOL>remainder = []  <EOL>for tr in rows:<EOL><INDENT>texts = []  <EOL>next_remainder = []<EOL>index = <NUM_LIT:0><EOL>tds = self._parse_td(tr)<EOL>for td in tds:<EOL><INDENT>while remainder and remainder[<NUM_LIT:0>][<NUM_LIT:0>] <= index:<EOL><INDENT>prev_i, prev_text, prev_rowspan = remainder.pop(<NUM_LIT:0>)<EOL>texts.append(prev_text)<EOL>if prev_rowspan > <NUM_LIT:1>:<EOL><INDENT>next_remainder.append((prev_i, prev_text,<EOL>prev_rowspan - <NUM_LIT:1>))<EOL><DEDENT>index += <NUM_LIT:1><EOL><DEDENT>text = _remove_whitespace(self._text_getter(td))<EOL>rowspan = int(self._attr_getter(td, '<STR_LIT>') or <NUM_LIT:1>)<EOL>colspan = int(self._attr_getter(td, '<STR_LIT>') or <NUM_LIT:1>)<EOL>for _ in range(colspan):<EOL><INDENT>texts.append(text)<EOL>if rowspan > <NUM_LIT:1>:<EOL><INDENT>next_remainder.append((index, text, rowspan - <NUM_LIT:1>))<EOL><DEDENT>index += <NUM_LIT:1><EOL><DEDENT><DEDENT>for prev_i, prev_text, prev_rowspan in remainder:<EOL><INDENT>texts.append(prev_text)<EOL>if prev_rowspan > <NUM_LIT:1>:<EOL><INDENT>next_remainder.append((prev_i, prev_text,<EOL>prev_rowspan - <NUM_LIT:1>))<EOL><DEDENT><DEDENT>all_texts.append(texts)<EOL>remainder = next_remainder<EOL><DEDENT>while remainder:<EOL><INDENT>next_remainder = []<EOL>texts = []<EOL>for prev_i, prev_text, prev_rowspan in remainder:<EOL><INDENT>texts.append(prev_text)<EOL>if prev_rowspan > <NUM_LIT:1>:<EOL><INDENT>next_remainder.append((prev_i, prev_text,<EOL>prev_rowspan - <NUM_LIT:1>))<EOL><DEDENT><DEDENT>all_texts.append(texts)<EOL>remainder = next_remainder<EOL><DEDENT>return all_texts<EOL>
Given a list of <tr>s, return a list of text rows.

Parameters
----------
rows : list of node-like
    List of <tr>s

Returns
-------
list of list
    Each returned row is a list of str text.

Notes
-----
Any cell with ``rowspan`` or ``colspan`` will have its contents copied
to subsequent cells.