def taxonomy_from_annotated_tree(self, dendropy_tree):
tip_to_taxonomy = {}<EOL>for tip in dendropy_tree.leaf_node_iter():<EOL><INDENT>tax = []<EOL>n = tip.parent_node<EOL>while n:<EOL><INDENT>node_taxonomy = self.taxonomy_from_node_name(n.label)<EOL>if node_taxonomy and n.parent_node:<EOL><INDENT>tax = [node_taxonomy]+tax<EOL><DEDENT>n = n.parent_node<EOL><DEDENT>tip_name = tip.taxon.label.replace('<STR_LIT:U+0020>','<STR_LIT:_>')<EOL>if tip_name in tip_to_taxonomy:<EOL><INDENT>raise Exception("<STR_LIT>" % tip_name)<EOL><DEDENT>if len(tax)==<NUM_LIT:0>:<EOL><INDENT>tip_to_taxonomy[tip_name] = []<EOL><DEDENT>else:<EOL><INDENT>tip_to_taxonomy[tip_name] = [t.strip() for t in '<STR_LIT>'.join(tax).split('<STR_LIT:;>')]<EOL><DEDENT><DEDENT>return tip_to_taxonomy<EOL>
Given an annotated dendropy tree, return the taxonomy of each tip

        Parameters
        ---------
        tree: dendropy.Tree
            Decorated tree to extract taxonomy from       
        Returns
        -------
        dictionary of tip name to array of taxonomic affiliations