Adds Python3 compatibility

FYI @bstein-sift 

Some minor changes to make the library Python3 compatible:
- Use proper relative imports
- Works around strange differences with json.loads / json.dumps between Python 2 and 3