Returns ``True`` if there exists a (possibly empty) range which is
        enclosed by both this range and other.

        Examples:

        * [1, 3] and [5, 7] are not connected
        * [5, 7] and [1, 3] are not connected
        * [2, 4) and [3, 5) are connected, because both enclose [3, 4)
        * [1, 3) and [3, 5) are connected, because both enclose the empty range
          [3, 3)
        * [1, 3) and (3, 5) are not connected

def is_connected(self, other):
        """
        Returns ``True`` if there exists a (possibly empty) range which is
        enclosed by both this range and other.

        Examples:

        * [1, 3] and [5, 7] are not connected
        * [5, 7] and [1, 3] are not connected
        * [2, 4) and [3, 5) are connected, because both enclose [3, 4)
        * [1, 3) and [3, 5) are connected, because both enclose the empty range
          [3, 3)
        * [1, 3) and (3, 5) are not connected
        """
        return self.upper > other.lower and other.upper > self.lower or (
            self.upper == other.lower and (self.upper_inc or other.lower_inc)
        ) or (
            self.lower == other.upper and (self.lower_inc or other.upper_inc)
        )