def are_exclusive(<EOL>stmt1, stmt2, exceptions=None<EOL>):  
<EOL>stmt1_parents = {}<EOL>children = {}<EOL>node = stmt1.parent<EOL>previous = stmt1<EOL>while node:<EOL><INDENT>stmt1_parents[node] = <NUM_LIT:1><EOL>children[node] = previous<EOL>previous = node<EOL>node = node.parent<EOL><DEDENT>node = stmt2.parent<EOL>previous = stmt2<EOL>while node:<EOL><INDENT>if node in stmt1_parents:<EOL><INDENT>if isinstance(node, If) and exceptions is None:<EOL><INDENT>if (<EOL>node.locate_child(previous)[<NUM_LIT:1>]<EOL>is not node.locate_child(children[node])[<NUM_LIT:1>]<EOL>):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>elif isinstance(node, TryExcept):<EOL><INDENT>c2attr, c2node = node.locate_child(previous)<EOL>c1attr, c1node = node.locate_child(children[node])<EOL>if c1node is not c2node:<EOL><INDENT>first_in_body_caught_by_handlers = (<EOL>c2attr == "<STR_LIT>"<EOL>and c1attr == "<STR_LIT:body>"<EOL>and previous.catch(exceptions)<EOL>)<EOL>second_in_body_caught_by_handlers = (<EOL>c2attr == "<STR_LIT:body>"<EOL>and c1attr == "<STR_LIT>"<EOL>and children[node].catch(exceptions)<EOL>)<EOL>first_in_else_other_in_handlers = (<EOL>c2attr == "<STR_LIT>" and c1attr == "<STR_LIT>"<EOL>)<EOL>second_in_else_other_in_handlers = (<EOL>c2attr == "<STR_LIT>" and c1attr == "<STR_LIT>"<EOL>)<EOL>if any(<EOL>(<EOL>first_in_body_caught_by_handlers,<EOL>second_in_body_caught_by_handlers,<EOL>first_in_else_other_in_handlers,<EOL>second_in_else_other_in_handlers,<EOL>)<EOL>):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>elif c2attr == "<STR_LIT>" and c1attr == "<STR_LIT>":<EOL><INDENT>return previous is not children[node]<EOL><DEDENT><DEDENT>return False<EOL><DEDENT>previous = node<EOL>node = node.parent<EOL><DEDENT>return False<EOL>
return true if the two given statements are mutually exclusive

    `exceptions` may be a list of exception names. If specified, discard If
    branches and check one of the statement is in an exception handler catching
    one of the given exceptions.

    algorithm :
     1) index stmt1's parents
     2) climb among stmt2's parents until we find a common parent
     3) if the common parent is a If or TryExcept statement, look if nodes are
        in exclusive branches