I put a quick implementation of what I think is the same functionality for IAB. Would a cleaned-up version of this work for what we want to do here? (I know there are some issues with it, like the root can have a branch length, so we want a different test to see if you've hit the root, and we'd need to take a list of tip ids rather than a biom table.) 

```
def get_observed_nodes(tree, table, sample_id, verbose=False):
    observed_otus = [obs_id for obs_id in table.ObservationIds 
                if table.getValueByIds(obs_id, sample_id) > 0]
    observed_nodes = set()
    # iterate over the observed OTUs
    for otu in observed_otus:
        t = tree.find(otu)
        observed_nodes.add(t)
        if verbose:
            print t.name, t.length, 
        for internal_node in t.ancestors():
            if internal_node.length is None:
                # we've hit the root
                if verbose:
                    print
            else:
                if verbose and internal_node not in observed_nodes:
                    print internal_node.length,
                observed_nodes.add(internal_node)
    return observed_nodes

def phylogenetic_diversity(tree, table, sample_id, verbose=False):
    observed_nodes = get_observed_nodes(tree, table, sample_id, verbose=verbose)
    pd = sum(o.length for o in observed_nodes)
    return pd
```