def generate_validator_constructor(ns, data_type):
dt, nullable_dt = unwrap_nullable(data_type)<EOL>if is_list_type(dt):<EOL><INDENT>v = generate_func_call(<EOL>'<STR_LIT>',<EOL>args=[<EOL>generate_validator_constructor(ns, dt.data_type)],<EOL>kwargs=[<EOL>('<STR_LIT>', dt.min_items),<EOL>('<STR_LIT>', dt.max_items)],<EOL>)<EOL><DEDENT>elif is_map_type(dt):<EOL><INDENT>v = generate_func_call(<EOL>'<STR_LIT>',<EOL>args=[<EOL>generate_validator_constructor(ns, dt.key_data_type),<EOL>generate_validator_constructor(ns, dt.value_data_type),<EOL>]<EOL>)<EOL><DEDENT>elif is_numeric_type(dt):<EOL><INDENT>v = generate_func_call(<EOL>'<STR_LIT>'.format(dt.name),<EOL>kwargs=[<EOL>('<STR_LIT>', dt.min_value),<EOL>('<STR_LIT>', dt.max_value)],<EOL>)<EOL><DEDENT>elif is_string_type(dt):<EOL><INDENT>pattern = None<EOL>if dt.pattern is not None:<EOL><INDENT>pattern = repr(dt.pattern)<EOL><DEDENT>v = generate_func_call(<EOL>'<STR_LIT>',<EOL>kwargs=[<EOL>('<STR_LIT>', dt.min_length),<EOL>('<STR_LIT:max_length>', dt.max_length),<EOL>('<STR_LIT>', pattern)],<EOL>)<EOL><DEDENT>elif is_timestamp_type(dt):<EOL><INDENT>v = generate_func_call(<EOL>'<STR_LIT>',<EOL>args=[repr(dt.format)],<EOL>)<EOL><DEDENT>elif is_user_defined_type(dt):<EOL><INDENT>v = fmt_class(dt.name) + '<STR_LIT>'<EOL>if ns.name != dt.namespace.name:<EOL><INDENT>v = '<STR_LIT>'.format(fmt_namespace(dt.namespace.name), v)<EOL><DEDENT><DEDENT>elif is_alias(dt):<EOL><INDENT>name = fmt_class(dt.name) + '<STR_LIT>'<EOL>if ns.name != dt.namespace.name:<EOL><INDENT>name = '<STR_LIT>'.format(fmt_namespace(dt.namespace.name), name)<EOL><DEDENT>v = name<EOL><DEDENT>elif is_boolean_type(dt) or is_bytes_type(dt) or is_void_type(dt):<EOL><INDENT>v = generate_func_call('<STR_LIT>'.format(dt.name))<EOL><DEDENT>else:<EOL><INDENT>raise AssertionError('<STR_LIT>' % dt)<EOL><DEDENT>if nullable_dt:<EOL><INDENT>return generate_func_call('<STR_LIT>', args=[v])<EOL><DEDENT>else:<EOL><INDENT>return v<EOL><DEDENT>
Given a Stone data type, returns a string that can be used to construct
the appropriate validation object in Python.