def METHOD_NAME(thing):
    "Compute a hash of an object. Works on dicts and lists."
    try:
        return hash(thing)
    except TypeError:
        if isinstance(thing, Mapping):
            return METHOD_NAME(sorted(thing.items()))
        elif isinstance(thing, Iterable):
            try:
                return hash(tuple(METHOD_NAME(t) for t in thing))
            except TypeError: # iteration over 0-d array
                return hash(type(thing))
        raise