def _lookup(self, dot_name, contexts):
<EOL>filters = [x for x in map(lambda x: x.strip(), dot_name.split('<STR_LIT:|>'))]<EOL>dot_name = filters[<NUM_LIT:0>]<EOL>filters = filters[<NUM_LIT:1>:]<EOL>if not dot_name.startswith('<STR_LIT:.>'):<EOL><INDENT>dot_name = '<STR_LIT>' + dot_name<EOL><DEDENT>paths = dot_name.split('<STR_LIT:/>')<EOL>last_path = paths[-<NUM_LIT:1>]<EOL>refer_context = last_path == '<STR_LIT>' or last_path == '<STR_LIT:.>' or last_path == '<STR_LIT:..>'<EOL>paths = paths if refer_context else paths[:-<NUM_LIT:1>]<EOL>level = <NUM_LIT:0><EOL>for path in paths:<EOL><INDENT>if path == '<STR_LIT:..>':<EOL><INDENT>level -= <NUM_LIT:1><EOL><DEDENT>elif path != '<STR_LIT:.>':<EOL><INDENT>level += len(path.strip('<STR_LIT:.>').split('<STR_LIT:.>'))<EOL><DEDENT><DEDENT>names = last_path.split('<STR_LIT:.>')<EOL>if refer_context or names[<NUM_LIT:0>] == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>value = contexts[level-<NUM_LIT:1>]<EOL><DEDENT>except:<EOL><INDENT>value = None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>value = lookup(names[<NUM_LIT:0>], contexts, level)<EOL><DEDENT>if not refer_context:<EOL><INDENT>for name in names[<NUM_LIT:1>:]:<EOL><INDENT>try:<EOL><INDENT>index = parse_int(name)<EOL>name = parse_int(name) if isinstance(value, (list, tuple)) else name<EOL>value = value[name]<EOL><DEDENT>except:<EOL><INDENT>value = None<EOL>break;<EOL><DEDENT><DEDENT><DEDENT>for f in filters:<EOL><INDENT>try:<EOL><INDENT>func = self.root.filters[f]<EOL>value = func(value)<EOL><DEDENT>except:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>return value<EOL>
lookup value for names like 'a.b.c' and handle filters as well