Stem is a Python controller library that allows applications to interact with Tor (https://www.torproject.org/).
For tutorials and API documentation see Stem’s homepage.
To install you can either use…
pip install stem
… or install from the source tarball. Stem supports both the python 2.x and 3.x series. To use its python3 counterpart you simply need to install using that version of python.
python3 setup.py install