How to make external queries from the scriptable interface (python)?

Hi,

I've used unbound's scriptable interface to embed python programs and modify responses for a long time now.
But now I would have to make external calls, which don't return in a constant time (like a HTTP query, a database operation etc).

Is it possible to do this without blocking unbound, and if yes, how?

Ultimately, I would like to open a threadpool, which handles blocking operations and gets the queries from unbound threads, and when the response is ready, call back to unbound somehow.

Thanks,