Replaced cStringIO by StringIO so unicode is supported