def __get_depth(root):
if root is None:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>left  = __get_depth(root.left)<EOL>right = __get_depth(root.right)<EOL>if abs(left-right) > <NUM_LIT:1> or -<NUM_LIT:1> in [left, right]:<EOL><INDENT>return -<NUM_LIT:1><EOL><DEDENT>return <NUM_LIT:1> + max(left, right)<EOL>
return 0 if unbalanced else depth + 1