Fix XenAPI.py on python2.7

This fix was made by Mike Mcclurg here:

https://bugs.launchpad.net/xcp/+bug/917913

I tested it on Ubuntu raring and XenServer release 6.2.50-74022c