def get_context(self, max_frames=None, missing_entities=[]):
if not max_frames or max_frames > len(self.frame_stack):<EOL><INDENT>max_frames = len(self.frame_stack)<EOL><DEDENT>missing_entities = list(missing_entities)<EOL>context = []<EOL>for i in xrange(max_frames):<EOL><INDENT>frame_entities = [entity.copy() for entity in self.frame_stack[i].entities]<EOL>for entity in frame_entities:<EOL><INDENT>entity['<STR_LIT>'] = entity.get('<STR_LIT>', <NUM_LIT:1.0>) / (<NUM_LIT> + i)<EOL><DEDENT>context += frame_entities<EOL><DEDENT>result = []<EOL>if len(missing_entities) > <NUM_LIT:0>:<EOL><INDENT>for entity in context:<EOL><INDENT>if entity.get('<STR_LIT:data>') in missing_entities:<EOL><INDENT>result.append(entity)<EOL>missing_entities.remove(entity.get('<STR_LIT:data>'))<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>result = context<EOL><DEDENT>return result<EOL>
Constructs a list of entities from the context.

Args:
    max_frames(int): maximum number of frames to look back
    missing_entities(list of str): a list or set of tag names, as strings

Returns:
    list: a list of entities