def _equal_topology(tree1, tree2):
 term_names1 = set((term.name for term in tree1.find_clades(terminal=True)))
 term_names2 = set((term.name for term in tree2.find_clades(terminal=True)))
 return ((term_names1 == term_names2) and (_bitstring_topology(tree1) == _bitstring_topology(tree2)))

def _equal_topology ( tree1 , tree2 ) : term_names1 = set ( ( term . name for term in tree1 . find_clades ( terminal = True ) ) ) term_names2 = set ( ( term . name for term in tree2 . find_clades ( terminal = True ) ) ) return ( ( term_names1 == term_names2 ) and ( _bitstring_topology ( tree1 ) == _bitstring_topology ( tree2 ) ) )
are two trees are equal in terms of topology and branch lengths .