def _hash(o, seen=None):
    if seen is None:
        seen = set()
    if id(o) in seen:
        return "recursion on %s" % id(o)
    else:
        seen.add(id(o))
    print "h%s" % o
    try:
        return hash(o)
    except TypeError:
        pass
    if isinstance(o, dict):
        return ('dict', (tuple((_hash(k, seen), _hash(v, seen)) for k,v in sorted(o.items()))))
    elif isinstance(o, list):
        return ('list', tuple(_hash(v, seen) for v in o))
    elif isinstance(o, set):
        return ('set', tuple(_hash(v, seen) for v in sorted(o)))
    else:
        raise TypeError, "Unable to hash %s" % o
dataset/ETHPy150Open jdunck/django-template-help/template_help/templatetags/context_helper_exhaustive.py/_hash/original