#NEWLINE# def expand( self ) : #NEWLINE# #INDENT# for i in range ( len ( self . args ) ) : #NEWLINE# #INDENT# arg = self . args [ i ] #NEWLINE# if isinstance ( arg , Or ) : #NEWLINE# #INDENT# arest = ( self . args [ : i ] + self . args [ ( a + 1 ) : ] ) #NEWLINE# orterms = [ And ( * ( arest + ( a , ) ) ) for a in arg . args ] #NEWLINE# for j in range ( len ( orterms ) ) : #NEWLINE# #INDENT# if isinstance ( orterms [ j ] , Logic ) : #NEWLINE# #INDENT# orterms [ j ] = orterms [ j ] . expand ( ) #NEWLINE# #UNINDENT# #UNINDENT# res = Or ( * orterms ) #NEWLINE# return res #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return self