def extract_ranges(row, ranges: ColRanges) -> List[Text]:
out = []<EOL>for r in ranges:<EOL><INDENT>if isinstance(r, int):<EOL><INDENT>r = (r, r + <NUM_LIT:1>)<EOL><DEDENT>if r[<NUM_LIT:1>] is None:<EOL><INDENT>r = (r[<NUM_LIT:0>], len(row))<EOL><DEDENT>out.extend(row[r[<NUM_LIT:0>]:r[<NUM_LIT:1>]])<EOL><DEDENT>return [x for x in (y.strip() for y in out) if x]<EOL>
Extracts a list of ranges from a row:

- If the range is an int, just get the data at this index
- If the range is a tuple of two ints, use them as indices in a slice
- If the range is an int then a None, start the slice at the int and go
  up to the end of the row.