StringIO  expects binary data as input (not decoded unicode/string)