def holes(refWindow, intervals):
    """
    Given a window and a set of disjoint subintervals, return the
    "holes", which are the intervals of the refWindow not covered by
    the given subintervals.
    """
    winId, winStart, winEnd = refWindow
    output = []
    intervals = sorted(intervals)
    lastE = winStart
    for (s, e) in intervals:
        if s > lastE:
            output.append((lastE, s))
        lastE = e
    if lastE < winEnd:
        output.append((lastE, winEnd))
    return output