txtorcon is an implementation of the control-spec for Tor using the Twisted networking library for Python (supports Py2, PyPy, and Py3). With txtorcon you can launch tor; connect to already-running tor instances; use tor as a client (via SOCKS5); set up (onion) services over tor; change all aspects of configuration; track live state (active circuits and streams, etc); do DNS via Tor; and query other information from the tor daemon.