Easy to understand Python code below. Add newInterval to the existing intervals and keep merging.

```
intervals = sorted(intervals+[newInterval], key = lambda x: x.start)
output = [intervals[0]]
for i in xrange(1, len(intervals)):
if intervals[i].start <= output[-1].end:
output[-1] = Interval(output[-1].start, max(intervals[i].end, output[-1].end))
else:
output.append(intervals[i])
return output
```