if at any point one root becomes None and the other root is not None , then they are not mirrors . This condition verifies that structures of tree are mirrors of each other .
if ( not ( root1 == None and root2 == None ) ) : NEW_LINE INDENT return " No " NEW_LINE DEDENT if ( not len ( st1 ) == 0 and not len ( st2 ) == 0 ) : NEW_LINE INDENT root1 = st1 [ - 1 ] NEW_LINE root2 = st2 [ - 1 ] NEW_LINE st1 . pop ( - 1 ) NEW_LINE st2 . pop ( - 1 ) NEW_LINE DEDENT