@classmethod<EOL><INDENT>def condense_ranges(cls, ranges):<DEDENT>
result = []<EOL>if ranges:<EOL><INDENT>ranges.sort(key=lambda tup: tup[<NUM_LIT:0>])<EOL>result.append(ranges[<NUM_LIT:0>])<EOL>for i in range(<NUM_LIT:1>, len(ranges)):<EOL><INDENT>if result[-<NUM_LIT:1>][<NUM_LIT:1>] + <NUM_LIT:1> >= ranges[i][<NUM_LIT:0>]:<EOL><INDENT>result[-<NUM_LIT:1>] = (result[-<NUM_LIT:1>][<NUM_LIT:0>], max(result[-<NUM_LIT:1>][<NUM_LIT:1>], ranges[i][<NUM_LIT:1>]))<EOL><DEDENT>else:<EOL><INDENT>result.append(ranges[i])<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>
Sorts and removes overlaps