threading - Thread-based parallelism - Python 3.9.5 documentation
Source code: Lib/threading.py This module constructs higher-level threading interfaces on top of the lower level module. See also the module. Changed in version 3.7: This module used to be optional, it is now always available. Note While they are not listed below, the names used for some methods and functions in this module in the Python 2.x series are still supported by this module.
https://docs.python.org/3/library/threading.html#using-locks-conditions-and-semaphores-in-the-with-statement