code: def get_context(self, max_frames=None, missing_entities=[]):
          
          if not max_frames or max_frames > len(self.frame_stack):
              max_frames = len(self.frame_stack)
  
          missing_entities = list(missing_entities)
          context = []
          for i in xrange(max_frames):
              frame_entities = [entity.copy() for entity in self.frame_stack[i].entities]
              for entity in frame_entities:
                  entity['confidence'] = entity.get('confidence', 1.0) / (2.0 + i)
              context += frame_entities
  
          result = []
          if len(missing_entities) > 0:
              for entity in context:
                  if entity.get('data') in missing_entities:
                      result.append(entity)
                      # NOTE: this implies that we will only ever get one
                      # of an entity kind from context, unless specified
                      # multiple times in missing_entities. Cannot get
                      # an arbitrary number of an entity kind.
                      missing_entities.remove(entity.get('data'))
          else:
              result = context
  
          return result
docs: 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