Pyqi port

NOT READY FOR MERGE

@wasade, this includes a huge change on the code base and the pyqi port is almost completed (some remaining tests to be added).

I issue the PR so you can start reviewing and we can speed-up de process.

Thanks!