PyMOTW: trace

The trace module helps you understand the way your program runs. You can trace the statements executed, produce coverage reports, and investigate the relationships between functions that call each other.

Read more at pymotw.com: trace