Rope is the world's most advanced open source Python refactoring library (that's the upstream author's words).