@register.simple_tag
def category_tree(id=None):
    active_cat = None
    if id:
        try:
            active_cat = Category.objects.active().get(id=id)
        except Category.DoesNotExist:
            active_cat = None
    # We call the category on every page so we will cache
    # The actual structure to save db hits
    lang = get_language()
    current_site = Site.objects.get_current()
    cache_key = "cat-%s-%s" % (current_site.id, lang)
    existing_tree = cache.get(cache_key, None)
    if existing_tree is None:
        root = Element("ul")
        for cats in Category.objects.root_categories():
            recurse_for_children(cats, root, active_cat)
        existing_tree = root
        cache.set(cache_key, existing_tree)
    # If we have an active cat, search through and identify it
    # This search is less expensive than the multiple db calls
    if active_cat:
        active_cat_id = "category-%s" % active_cat.id
        for li in existing_tree.getiterator("li"):
            if li.attrib["id"] == active_cat_id:
                link = li.find("a")
                link.attrib["class"] = "current"
                break
    return tostring(existing_tree, 'utf-8')
a.__xor__(b) <==> a^b
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/templatetags/satchmo_category.py/category_tree--crossover with--dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/util/arrays.py/VectorN.__xor__