def get_outer_boundaries(regions, cls, rest_cls):
    """
    Assuming rest periods alternate with other classes, find the 
    outer boundaries of the rest regions enclosing all regions for cls
    
    >>> l = [0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 2, 0, 3, 3, 0, 4]
    >>> d = get_regions(l)
    >>> get_outer_boundaries(d, 1, 0)
    (0, 12)
    >>> get_outer_boundaries(d, 2, 0)
    (10, 14)
    >>> get_outer_boundaries(d, 4, 0)
    (16, 18)
    """
    my_start = regions[cls][0][0]
    my_end = regions[cls][-1][-1]
    
    first = my_start # the rest region preceding will end at this point
    last = my_end # the following rest region will start at this point
    for r in regions[rest_cls]:
        if r[1] == my_start:
            first = r[0]
        if r[0] == my_end:
            last = r[1]
            break
    return (first, last)