StringIO Python 3 compatibility

Signed-off-by: Michal Čihař <michal@cihar.com>