sendall buf convertion atempt from unicode to str

Sendall method raises **Typerror** without considering a unicode **buf** parameter. Here i try to convert from unicode to str before testing isinstance(buf, bytes).