Python 3: compatibility of StringIO() and dict.iterkeys()

Change-Id: Ia671cacbf1852984c41b374986cc2e9581247b99
Merge "Python 3: compatibility of StringIO() and dict.iterkeys()"