def does_match_definition(given, main, secondary):
assert isinstance(secondary, tuple)<EOL>assert len(secondary) == <NUM_LIT:2>  <EOL>types = decompose_type(given)<EOL>if isinstance(types[<NUM_LIT:0>], main):<EOL><INDENT>return True<EOL><DEDENT>if len(types) >= <NUM_LIT:2>:<EOL><INDENT>cond1 = isinstance(types[<NUM_LIT:0>], main)<EOL>cond2 = isinstance(types[<NUM_LIT:1>], secondary)<EOL>cond3 = isinstance(types[<NUM_LIT:1>], main)<EOL>cond4 = isinstance(types[<NUM_LIT:0>], secondary)<EOL>if (cond1 and cond2) or (cond3 and cond4):<EOL><INDENT>return True<EOL><DEDENT>if len(types) >= <NUM_LIT:3>:<EOL><INDENT>classes = set([tp.__class__ for tp in types[:<NUM_LIT:3>]])<EOL>desired = set([main] + list(secondary))<EOL>diff = classes.symmetric_difference(desired)<EOL>if not diff:<EOL><INDENT>return True<EOL><DEDENT>if len(diff) == <NUM_LIT:2>:<EOL><INDENT>items = list(diff)<EOL>return (<EOL>issubclass(<EOL>items[<NUM_LIT:0>], items[<NUM_LIT:1>]) or issubclass(items[<NUM_LIT:1>], items[<NUM_LIT:0>]))<EOL><DEDENT>return False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>
implementation details