'Returns True if the entity may have been updated since stream_pos'

def has_entity_changed(self, entity, stream_pos):

    assert ((type(stream_pos) is int) or (type(stream_pos) is long))
    if (stream_pos < self._earliest_known_stream_pos):
        self.metrics.inc_misses()
        return True
    latest_entity_change_pos = self._entity_to_key.get(entity, None)
    if (latest_entity_change_pos is None):
        self.metrics.inc_hits()
        return False
    if (stream_pos < latest_entity_change_pos):
        self.metrics.inc_misses()
        return True
    self.metrics.inc_hits()
    return False
