'Return the entity ids that existed in this run.
Specify point_in_time if you want to know which existed at that point
in time inside the run.'

def entity_ids(self, point_in_time=None):

    from sqlalchemy.orm.session import Session
    session = Session.object_session(self)
    assert (session is not None), 'RecorderRuns    need    to    be    persisted'
    query = session.query(distinct(States.entity_id)).filter((States.last_updated >= self.start))
    if (point_in_time is not None):
        query = query.filter((States.last_updated < point_in_time))
    elif (self.end is not None):
        query = query.filter((States.last_updated < self.end))
    return [row[0] for row in query]
