def stop_worker(thread_id: int) -> None:
    'Raise an error in a thread so it is possible to asynchronously stop thread execution.'
    ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(thread_id), ctypes.py_object(SystemExit))
Raise an error in a thread so it is possible to asynchronously stop thread execution.
def stop_worker(thread_id: int) -> None:
    
    ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(thread_id), ctypes.py_object(SystemExit))