def as_future(self, query):
<EOL>if not self._pool:<EOL><INDENT>self._pool = ThreadPoolExecutor(max_workers=self._max_workers)<EOL><DEDENT>old_future = self._pool.submit(query)<EOL>new_future = Future()<EOL>IOLoop.current().add_future(<EOL>old_future, lambda f: chain_future(f, new_future)<EOL>)<EOL>return new_future<EOL>
Wrap a `sqlalchemy.orm.query.Query` object into a
        `concurrent.futures.Future` so that it can be yielded.

        Parameters
        ----------
        query : sqlalchemy.orm.query.Query
            SQLAlchemy query object to execute

        Returns
        -------
            tornado.concurrent.Future
                A `Future` object wrapping the given query so that tornado can
                await/yield on it