How does the Temporal Python SDK inject exceptions into a thread?

How does the Temporal Python SDK inject exceptions into a thread? When I use Temporal for a synchronous function, I need to start a thread to execute the synchronous function. The main thread loops to send heartbeats and check whether to exit. Exception injection is very helpful for terminating the synchronous function thread early. Note: I cannot perform any instrumentation in the synchronous function.