Add iPython3 compatibility

This includes @d1ffuz0r 's changes and also makes it compatible to the latest API changes in Python 3. Also adds new parameters for Mongo authentication, which is important when using the same DB for multiple users.

Maybe this should be merged as extra branch, since the old version is still useful for the currten iPython 2 release.