This script is buggy and won't work in some situations. For example, it doesn't support navigating python sources, which contain multi-line imports like this:
import some.very.long.module, \ another.long.module.name from some.very.long import module, \ function, CONSTANT
because it handles the buffer as a bunch of single lines. It needs some serious fixing in this regard.
Even after fixing that I couldn't make it work on the sources I was working on. It works with simple test 'hello-world'-type scripts.
It seems to me that trying to actually parse the edited buffer with now-obsolete compiler package is not a good idea.
Unfortunately, I know not of any alternatives to this. Will probably have to write my own plugin. If I do, I'll post a note here as well.