python 3.x support added

I used some... not so beautiful solutions to make python 2 and 3 be able to run the same script. If you do not like it, do not accept this commit, or change it later on. As I commented, I did not thoroughly tested the
script, so if you want to do some checking on it, feel invited to do so.

mafagafogigante