adapts code to run under python3
corrects indentation