Porting to python 3

Hi,

In this pull request, I ported kptool to python 3.

It now works (or at least passes all the tests) in python 2.6, 2.7 and 3.3, but not earlier because 3.3 is the version that allows u'' in the source.