threadpoolctl contains Python helpers to limit the number of threads used in native libraries that handle their own internal threadpool.