Added detection of python version to fix unicode encoding issuse