def collapse_nodes(self, min_dist=<NUM_LIT>, min_support=<NUM_LIT:0>):
nself = self.copy()<EOL>for node in nself.treenode.traverse():<EOL><INDENT>if not node.is_leaf():<EOL><INDENT>if (node.dist <= min_dist) | (node.support < min_support):<EOL><INDENT>node.delete()<EOL><DEDENT><DEDENT><DEDENT>nself._coords.update()<EOL>return nself<EOL>
Returns a copy of the tree where internal nodes with dist <= min_dist
are deleted, resulting in a collapsed tree. e.g.:

newtre = tre.collapse_nodes(min_dist=0.001)
newtre = tre.collapse_nodes(min_support=50)