python 3 adaptation beginning

Very very dirty python adaptation of the code