COMP: Fix the writing of .idx files

The previous change to the print function broke the wrapping build.
This should fix the writing of the .idx files.

Fixed also imports of stringIO, we can even do it without six, see:
http://python3porting.com/stdlib.html

Use also from __future__ import unicode_literals, so that StrinIO
works on both Python 2 and 3

Fix also a problem in igenerator.py with the .h file creation, the \n
was misplaced.

Change-Id: Ia7f57f0bcfc1e21bc63370ffa0373c73db4c4943
Merge topic 'FixPythonWrapping4'

419625e9 COMP: Fix the writing of .idx files