A utility function to test above functions
def test ( root , k ) : NEW_LINE INDENT nr = nextRightNodeUtil ( root , k ) NEW_LINE if ( nr != None ) : NEW_LINE INDENT print ( " Next ▁ Right ▁ of " , k , " is " , nr . key ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No ▁ next ▁ right ▁ node ▁ found ▁ for " , k ) NEW_LINE DEDENT DEDENT