NB: In Python >= 3.9 the idiomatic way to do this is to_thread(), not familiar with these ASGI functions but I would guess they're a polyfill and/or predate 3.9.
https://docs.python.org/3/library/asyncio-task.html#asyncio....
https://docs.python.org/3/library/asyncio-task.html#asyncio....