woden501 via matrix - Looking for Python Pointers

Looking for pointer in the right direction for something I'm working on right now that someone here may know some tools to assist the effort.

Context: I've inherited a rather large python codebase on the scale of maybe 100k+ lines of code spread over a few hundred files written by dozens of researchers over years of effort. They want me to optimize it.

Basically what I'm hoping to find are a few tools that are a bit more thorough and useful at tracking the flow of the code, identifying unused portions, diagramming, etc so that I can come to grips with the codebase a bit before diving in and optimizing. Nothing really fitting what I'm looking for has turned up in my scouring of various internet sources, so I'm hoping someone here has done something similar and knows of a few before I just start digging through it with an IDE and documenting the hell out of everything manually.