def overlap(start1, end1, start2, end2):
return not (end1 < start2 or end2 < start1)<EOL>
Does the range (start1, end1) overlap with (start2, end2)?

From Ned Batchelder
http://nedbatchelder.com/blog/201310/range_overlap_in_two_compares.html