Converting any fun to a suspended fun with high lamba expression

I’m looking for a way to send Any function as a parameter and get back a suspended function
this is one example of the possible function and how I am solving this:
Possible function

fun getSomething(): List<SomethingObject>

Incorrect approachment

suspend fun AnyClass.awaitAll(): List<SomethingObject> = withContext(Dispatchers.IO) { getSomething() }

But what I really want is something like this:

suspend fun <T : Any?> safeQuery(query: () -> Unit): () -> Unit {
     return withContext(Dispatchers.IO) { query }
}

Is this what you are looking for?

fun <T> safeQuery(query: () -> T): suspend () -> T {
    return { withContext(Dispatchers.IO) { query() } }
}