def get_distance(self, target, target2=None, topology_only=False):
if target2 is None:<EOL><INDENT>target2 = self<EOL>root = self.get_tree_root()<EOL><DEDENT>else:<EOL><INDENT>root = self<EOL><DEDENT>target, target2 = _translate_nodes(root, target, target2)<EOL>ancestor = root.get_common_ancestor(target, target2)<EOL>dist = <NUM_LIT:0.0><EOL>for n in [target2, target]:<EOL><INDENT>current = n<EOL>while current != ancestor:<EOL><INDENT>if topology_only:<EOL><INDENT>if  current!=target:<EOL><INDENT>dist += <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>dist += current.dist<EOL><DEDENT>current = current.up<EOL><DEDENT><DEDENT>return dist<EOL>
Returns the distance between two nodes. If only one target is
specified, it returns the distance bewtween the target and the
current node.

Parameters:
-----------
target: 
    a node within the same tree structure.

target2: 
    a node within the same tree structure. If not specified, 
    current node is used as target2.

topology_only: 
    If set to True, distance will refer to the number of nodes 
    between target and target2.

Returns:
--------
branch length distance between target and target2. If topology_only 
flag is True, returns the number of nodes between target and target2.