python3 compatibility

Hi,

In addition to these changes, line 153 in toolchain.py throws “Type str doesn't support the buffer API”. It wasn't obvious to me what else needed to be cast as a string, so I tried replacing 153 in toolchain.py with "lines = join_continued_lines(str(stdout.split("\n")))" and 29 in tools.py with "return str(result)", and the same error came up both times. 

There may be more type errors to be found but this is where I got hung up.