def aggregate(itvs):
    """Aggregate *NOT overlapping* intervals (intersect must be empty) to
    remove gaps.

    >>> aggregate([])
    []
    >>> aggregate([(1, 2), (3, 4)])
    [(1, 4)]
    >>> aggregate([(3, 4), (1, 2)])
    [(1, 4)]
    """
    lg = len(itvs)
    if lg <= 1:
        return itvs
    itvs = sorted(itvs)
    res = []
    i = 1
    a, b = itvs[0]
    while True:
        if i == lg:
            res.append((a, b))
            return res
        else:
            x, y = itvs[i]
            if x == b + 1:
                b = y
            else:
                res.append((a, b))
                a, b = x, y
            i += 1
