wrap a synchronous function in an async one