':type intervals: List[Interval]
:type newInterval: Interval
:rtype: List[Interval]'

def insert(self, intervals, newInterval):

    result = []
    i = 0
    while ((i < len(intervals)) and (newInterval.start > intervals[i].end)):
        result += (intervals[i],)
        i += 1
    while ((i < len(intervals)) and (newInterval.end >= intervals[i].start)):
        newInterval = Interval(min(newInterval.start, intervals[i].start), max(newInterval.end, intervals[i].end))
        i += 1
    result += (newInterval,)
    result += intervals[i:]
    return result
