'Returns a ldap.cidict.cidict dictionary representing the
tree structure of the schema elements.'

def tree(self, schema_element_class, schema_element_filters=None):

    assert (schema_element_class in [ObjectClass, AttributeType])
    avail_se = self.listall(schema_element_class, schema_element_filters)
    top_node = '_'
    tree = ldap.cidict.cidict({top_node: []})
    for se in avail_se:
        tree[se] = []
    for se_oid in avail_se:
        se_obj = self.get_obj(schema_element_class, se_oid, None)
        if (se_obj.__class__ != schema_element_class):
            continue
        assert (se_obj.__class__ == schema_element_class), ('Schema    element    referenced    by    %s    must    be    of    class    %s    but    was    %s' % (se_oid, schema_element_class.__name__, se_obj.__class__))
        for s in (se_obj.sup or ('_',)):
            sup_oid = self.name2oid[schema_element_class].get(s, s)
            try:
                tree[sup_oid].append(se_oid)
            except:
                pass
    return tree
