'Usage:
with stream_id_gen.get_next() as stream_id:
# ... persist event ...'

def get_next(self):

    with self._lock:
        self._current += self._step
        next_id = self._current
        self._unfinished_ids.append(next_id)
    @contextlib.contextmanager
    def manager():
        try:
            (yield next_id)
        finally:
            with self._lock:
                self._unfinished_ids.remove(next_id)
    return manager()
