Walks an arbitrary python pbject.

    :param mixed obj: Any python object
    :param tuple path: A tuple of the set attributes representing the path to the value
    :param set memo: The list of attributes traversed thus far

    :rtype <tuple<tuple>, <mixed>>: The path to the value on the object, the value.

def objwalk(obj, path=(), memo=None):
    """
    Walks an arbitrary python pbject.

    :param mixed obj: Any python object
    :param tuple path: A tuple of the set attributes representing the path to the value
    :param set memo: The list of attributes traversed thus far

    :rtype <tuple<tuple>, <mixed>>: The path to the value on the object, the value.
    """
    if len( path ) > MAX_DEPTH + 1:
        yield path, obj # Truncate it!
    if memo is None:
        memo = set()
    iterator = None
    if isinstance(obj, Mapping):
        iterator = iteritems
    elif isinstance(obj, (Sequence, Set)) and not isinstance(obj, string_types):
        iterator = enumerate
    elif hasattr( obj, '__class__' ) and hasattr( obj, '__dict__' ) and type(obj) not in primitives: # If type(obj) == <instance>
        iterator = class_iterator
    elif hasattr(obj, '__iter__') or isinstance(obj, types.GeneratorType):
        obj = [o for o in obj]
    else:
        pass
    if iterator:
        if id(obj) not in memo:
            memo.add(id(obj))
            for path_component, value in iterator(obj):
                for result in objwalk(value, path + (path_component,), memo):
                    yield result
            memo.remove(id(obj))
    else:
        yield path, obj