cgitb is a valuable debugging tool in the standard library. It was originally designed for showing errors and debugging information in web applications and was later updated to include plain-text output as well, but unfortunately was never renamed. This has led to obscurity, and the module is not used as often as it could be.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.