#NEWLINE# @ apply_wraps #NEWLINE# def apply( self , other ) : #NEWLINE# #INDENT# n = self . n #NEWLINE# ( wkday , days_in_month ) = tslib . monthrange ( other . year , other . month ) #NEWLINE# monthsSince = ( ( other . month - self . startingMonth ) % 3 ) #NEWLINE# if ( ( n <= 0 ) and ( monthsSince != 0 ) ) : #NEWLINE# #INDENT# monthsSince = ( monthsSince - 3 ) #NEWLINE# #UNINDENT# if ( ( n <= 0 ) and ( ( monthsSince == 0 ) and ( other . day > 1 ) ) ) : #NEWLINE# #INDENT# n = ( n + 1 ) #NEWLINE# #UNINDENT# other = ( other + relativedelta ( months = ( ( 3 * n ) - monthsSince ) , day = 1 ) ) #NEWLINE# return other