#NEWLINE# def isBalanced( node , left = 0 , right = 0 ) : #NEWLINE# #INDENT# if ( not node ) : #NEWLINE# #INDENT# return ( ( left - right ) < 2 ) #NEWLINE# #UNINDENT# return ( isBalanced ( node . left , ( left + 1 ) , right ) and isBalanced ( node . right , left , ( right + 1 ) ) )