def complement_intervals(intervals: Sequence[tuple[float, float]]) -> Sequence[tuple[float, float]]:
    """Computes complement of union of intervals in [0, 2]."""
    complements: list[tuple[float, float]] = []
    a = 0.0
    for b, c in intervals:
        complements.append((a, b))
        a = c
    complements.append((a, 2.0))
    return tuple((a, b) for a, b in complements if a < b)
Computes complement of union of intervals in [0, 2].
cirq-core/cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py