'This function should only be used internally
See Set._union for docstring'

def _union(self, other):

    if other.is_UniversalSet:
        return S.UniversalSet
    if (other.is_Interval and self._is_comparable(other)):
        from sympy.functions.elementary.miscellaneous import Min, Max
        end = Min(self.end, other.end)
        start = Max(self.start, other.start)
        if ((end < start) or ((end == start) and ((end not in self) and (end not in other)))):
            return None
        else:
            start = Min(self.start, other.start)
            end = Max(self.end, other.end)
            left_open = (((self.start != start) or self.left_open) and ((other.start != start) or other.left_open))
            right_open = (((self.end != end) or self.right_open) and ((other.end != end) or other.right_open))
            return Interval(start, end, left_open, right_open)
    open_left_in_other_and_finite = (self.left_open and (sympify(other.contains(self.start)) is S.true) and self.start.is_finite)
    open_right_in_other_and_finite = (self.right_open and (sympify(other.contains(self.end)) is S.true) and self.end.is_finite)
    if (open_left_in_other_and_finite or open_right_in_other_and_finite):
        open_left = (self.left_open and (self.start not in other))
        open_right = (self.right_open and (self.end not in other))
        new_self = Interval(self.start, self.end, open_left, open_right)
        return set((new_self, other))
    return None
