contexts/python: strip the trailing newline