fix python3 code structure