Fixes issue #410 , IPython.core.ipapi deprecated

changes to ipy_completer to avoid using a deprecated module. Also, reorganized the imports to make it more obvious what imports are required for what versions of ipython. This has been tested against ipython-1.1. I'm sorry I don't have time to test against older versions, but I think it should be ok.