Making tests' usage of StringIO Python3 compatible