Encode/decode of call_and_wait output for Python 2/3