Got it working with python3 with minimal changes