#NEWLINE# def _intersect( self , other ) : #NEWLINE# #INDENT# '\n        This function should only be used internally\n\n        See Set._intersect for docstring\n        ' #NEWLINE# if ( not other . is_Interval ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# infty = ( S . NegativeInfinity , S . Infinity ) #NEWLINE# if ( self == Interval ( * infty ) ) : #NEWLINE# #INDENT# ( l , r ) = ( self . left , self . right ) #NEWLINE# if ( l . is_real or ( l in left_open ) or r . is_real or ( r in infty ) ) : #NEWLINE# #INDENT# return other #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . _is_comparable ( other ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# empty = False #NEWLINE# if ( ( self . start <= other . end ) and ( other . start <= self . end ) ) : #NEWLINE# #INDENT# if ( self . start < other . start ) : #NEWLINE# #INDENT# start = other . start #NEWLINE# left_open = other . left_open #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . start > other . start ) : #NEWLINE# #INDENT# start = self . start #NEWLINE# left_open = self . left_open #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# start = self . start #NEWLINE# left_open = ( self . left_open or other . left_open ) #NEWLINE# #UNINDENT# #UNINDENT# if ( self . end < other . end ) : #NEWLINE# #INDENT# end = self . end #NEWLINE# right_open = self . right_open #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . end > other . end ) : #NEWLINE# #INDENT# end = other . end #NEWLINE# right_open = other . right_open #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# end = self . end #NEWLINE# right_open = ( self . right_open or other . right_open ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( ( end - start ) == 0 ) and ( left_open or right_open ) ) : #NEWLINE# #INDENT# empty = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# empty = True #NEWLINE# #UNINDENT# if empty : #NEWLINE# #INDENT# return S . EmptySet #NEWLINE# #UNINDENT# return Interval ( start , end , left_open , right_open )