def isEncapsulated(interval1, interval2):
    """
    Is interval1 encapsulated by interval2?

    :param interval1:
    :param interval2:

    :return: True if interval1 is encapsulated by interval2 (including that they are equal).
    """
    if max(interval1.value) <= max(interval2.value) and min(interval1.value
        ) >= min(interval2.value):
        return True
    return False
