def do_render_tree(provider, root, template_name, collapse, context = None, attrs = {}):
    list = provider.get_categories(root)
    map = {}
    roots = construct_tree(list, map)
    return render_to_string(template_name, {'roots' : roots, 'collapse' : collapse, \
        'attrs_str': build_attrs_string(attrs), 'attrs' : attrs}, context)
 def construct(self, choices):
     self.map = {}
     all = [category for key, category in choices]
     self.root = construct_tree(all, map = self.map)
     self.built = True