def _check_collisions(self, new_range, existing_ranges):
def _contains(num, r1):<EOL><INDENT>return (num >= r1[<NUM_LIT:0>] and<EOL>num <= r1[<NUM_LIT:1>])<EOL><DEDENT>def _is_overlap(r1, r2):<EOL><INDENT>return (_contains(r1[<NUM_LIT:0>], r2) or<EOL>_contains(r1[<NUM_LIT:1>], r2) or<EOL>_contains(r2[<NUM_LIT:0>], r1) or<EOL>_contains(r2[<NUM_LIT:1>], r1))<EOL><DEDENT>for existing_range in existing_ranges:<EOL><INDENT>if _is_overlap(new_range, existing_range):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
Check for overlapping ranges.