Merge Overlapping Intervals In Python