def _dtype_to_default_stata_fmt(dtype, column, dta_version=<NUM_LIT>,<EOL>force_strl=False):
<EOL>if dta_version < <NUM_LIT>:<EOL><INDENT>max_str_len = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>max_str_len = <NUM_LIT><EOL>if force_strl:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT><DEDENT>if dtype.type == np.object_:<EOL><INDENT>inferred_dtype = infer_dtype(column, skipna=True)<EOL>if not (inferred_dtype in ('<STR_LIT:string>', '<STR_LIT>') or<EOL>len(column) == <NUM_LIT:0>):<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(col=column.name))<EOL><DEDENT>itemsize = max_len_string_array(ensure_object(column.values))<EOL>if itemsize > max_str_len:<EOL><INDENT>if dta_version >= <NUM_LIT>:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(excessive_string_length_error % column.name)<EOL><DEDENT><DEDENT>return "<STR_LIT:%>" + str(max(itemsize, <NUM_LIT:1>)) + "<STR_LIT:s>"<EOL><DEDENT>elif dtype == np.float64:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif dtype == np.float32:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif dtype == np.int32:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif dtype == np.int8 or dtype == np.int16:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>else:  <EOL><INDENT>raise NotImplementedError(<EOL>"<STR_LIT>".format(dtype=dtype))<EOL><DEDENT>
Map numpy dtype to stata's default format for this type. Not terribly
important since users can change this in Stata. Semantics are

object  -> "%DDs" where DD is the length of the string.  If not a string,
            raise ValueError
float64 -> "%10.0g"
float32 -> "%9.0g"
int64   -> "%9.0g"
int32   -> "%12.0g"
int16   -> "%8.0g"
int8    -> "%8.0g"
strl    -> "%9s"