In Python 3, encode() produces a bytes. The way this is printed makes it
very hard to read the clang-tidy output because everything gets jammed onto one
line (newlines are printed as \n).
The encode() was introduced here:
https://github.com/llvm/llvm-project/commit/a35efc4dcb70658ebd704c28dfeed4cc2bac095b
It seems that this was done to print non-ASCII characters correctly in Python 2,
and this seems worth preserving (though anyone still on Python 2 should really
be migrating).
For the time being, I've simply introduced a version distinction. I'm not sure
if there's a more idiomatic way to do this that works in both Python 2 and
Python 3 -- input welcome!