Update api and tests
Now compatible with both python 2 and 3 (only tested latest versions)