def _contains(a, b, c, d):
    """
    Whether inclusive interval [a,b] contains interval [c,d]
    """
    if not ((a <= b) and (c <= d)):
        raise ValueError("Left endpoint must be given before right endpoint: [{}, {}] does not contain [{}, {}]".format(a,b,c,d))
    return (a <= c) and (b >= d)