def make_hash(obj):
if isinstance(obj, (set, tuple, list)):<EOL><INDENT>return tuple([make_hash(e) for e in obj])<EOL><DEDENT>elif not isinstance(obj, dict):<EOL><INDENT>return hash(obj)<EOL><DEDENT>new_obj = copy.deepcopy(obj)<EOL>for k, v in new_obj.items():<EOL><INDENT>new_obj[k] = make_hash(v)<EOL><DEDENT>return hash(tuple(frozenset(new_obj.items())))<EOL>
Makes a hash from a dictionary, list, tuple or set to any level,
that contains only other hashable types (including any lists,
tuples, sets, and dictionaries).  See second answer (not the
accepted answer):
http://stackoverflow.com/questions/5884066/hashing-a-python-dictionary