def intervals_overlap(i1, i2):
    """Returns True if Interval i1 overlaps Interval i2. The intervals are considered to be closed, so the intervals
    still overlap if i1.end == i2.begin or i2.end == i1.begin.
    """

    return not (i1.end < i2.begin or i2.end < i1.begin)