code: def _subtract(start, stop, intervals):
      
      remainder_start = start
      sub_stop = None
      for sub_start, sub_stop in _collapse(intervals):
          if remainder_start < sub_start:
              yield _Interval(remainder_start, sub_start)
          remainder_start = sub_stop
      if sub_stop is not None and sub_stop < stop:
          yield _Interval(sub_stop, stop)
docs: Subtract intervals from a spanning interval.