def _write_string(f, s):
 binmode = fileobj_is_binary(f)
 if (binmode and isinstance(s, text_type)):
  s = encode_ascii(s)
 elif ((not binmode) and (not isinstance(f, text_type))):
  s = decode_ascii(s)
 elif (isinstance(f, StringIO) and isinstance(s, np.ndarray)):
  s = s.data
 f.write(s)

def _write_string ( f , s ) : binmode = fileobj_is_binary ( f ) if ( binmode and isinstance ( s , text_type ) ) : s = encode_ascii ( s ) elif ( ( not binmode ) and ( not isinstance ( f , text_type ) ) ) : s = decode_ascii ( s ) elif ( isinstance ( f , StringIO ) and isinstance ( s , np . ndarray ) ) : s = s . data f . write ( s )
write a string to a file .