Use StringIO for file-like string.