def inject_context(self, entity, metadata={}):
top_frame = self.frame_stack[<NUM_LIT:0>] if len(self.frame_stack) > <NUM_LIT:0> else None<EOL>if top_frame and top_frame.metadata_matches(metadata):<EOL><INDENT>top_frame.merge_context(entity, metadata)<EOL><DEDENT>else:<EOL><INDENT>frame = ContextManagerFrame(entities=[entity], metadata=metadata.copy())<EOL>self.frame_stack.insert(<NUM_LIT:0>, frame)<EOL><DEDENT>
Args:
    entity(object):
        format {'data': 'Entity tag as <str>',
                'key': 'entity proper name as <str>',
                 'confidence': <float>'
                 }
    metadata(object): dict, arbitrary metadata about the entity being added