def get(obj, path, view=False, afilter=None):
index = <NUM_LIT:0><EOL>path_count = len(path) - <NUM_LIT:1><EOL>target = obj<EOL>head = type(target)()<EOL>tail = head<EOL>up = None<EOL>for pair in path:<EOL><INDENT>key = pair[<NUM_LIT:0>]<EOL>target = target[key]<EOL>if view:<EOL><INDENT>if isinstance(tail, MutableMapping):<EOL><INDENT>if issubclass(pair[<NUM_LIT:1>], (MutableSequence, MutableMapping)) and index != path_count:<EOL><INDENT>tail[key] = pair[<NUM_LIT:1>]()<EOL><DEDENT>else:<EOL><INDENT>tail[key] = target<EOL><DEDENT>up = tail<EOL>tail = tail[key]<EOL><DEDENT>elif issubclass(tail.__class__, MutableSequence):<EOL><INDENT>if issubclass(pair[<NUM_LIT:1>], (MutableSequence, MutableMapping)) and index != path_count:<EOL><INDENT>tail.append(pair[<NUM_LIT:1>]())<EOL><DEDENT>else:<EOL><INDENT>tail.append(target)<EOL><DEDENT>up = tail<EOL>tail = tail[-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>if not issubclass(target.__class__, (MutableSequence, MutableMapping)):<EOL><INDENT>if (afilter and (not afilter(target))):<EOL><INDENT>raise dpath.exceptions.FilteredValue<EOL><DEDENT><DEDENT>index += <NUM_LIT:1><EOL><DEDENT>if view:<EOL><INDENT>return head<EOL><DEDENT>else:<EOL><INDENT>return target<EOL><DEDENT>
Get the value of the given path.

    Arguments:

    obj -- Object to look in.
    path -- A list of keys representing the path.

    Keyword Arguments:

    view -- Return a view of the object.