A list of python import statements in the buffer
Populate the above list. search by looking for "^import" or "^from" (skipping those in comments or strings).
Then reverse the list, clean out text properties and change \n to \\n so that output doesn't end up wrong.
Run emacs.complete(symbol, python-imports) and return the list of completions (in another buffer)
Use a regular expression to go backward and thereby find the complete symbol before point. This seems a little odd to me. I seems like it would be easier to just trust the syntax-table that has already been defined for the mode and just do backward-word from the current position (with a save-excursion). As a guess I'd say it's so that it can treat "." as part of the symbol and skip over that to the beginning of a module/class name.
Find the list of completions (using python-symbol-completions) or just scroll the completions window if they've already been found.
"hippie-expand" version for doing symbol completions. Basically "he-" does all the heavy lifting hereit just needs to be
given the python-symbol-completions and python-partial-symbol functions.