Fix Py3 compatibility issues

* Replace of urllib by six urlparse
* Convert dict keys into list to be able to retrieve the first element
* Use integer division for integers
* Use int instead of long in XML serialization/deserialization under Py3

Co-author: Cyril Roelandt <cyril.roelandt@enovance.com>

Change-Id: Ia79c831310775bf1c3dbec06010f8949c3a73887
Merge "Fix Py3 compatibility issues"