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

def merge(self, intervals):

    if (not intervals):
        return intervals
    intervals.sort(key=(lambda x: x.start))
    result = [intervals[0]]
    for i in xrange(1, len(intervals)):
        (prev, current) = (result[(-1)], intervals[i])
        if (current.start <= prev.end):
            prev.end = max(prev.end, current.end)
        else:
            result.append(current)
    return result
