human
Complete this python program:
def convert_numpy(numpy_type):
assistant
#Here is the Python code you requested.

    """Return a tuple containing a function which converts a list into a numpy
    array and the type produced by the converter function.
    Parameters
    numpy_type : numpy data-type
    The numpy type required of an array returned by ``converter``. Must be a
    valid `numpy type <http://docs.scipy.org/doc/numpy/user/basics.types.html>`_,
    e.g. numpy.int, numpy.uint, numpy.int8, numpy.int64, numpy.float,
    numpy.float64, numpy.str.
    Returns
    (converter, converter_type) : (function, generic data-type)
    ``converter`` is a function which accepts a list and converts it to a
    numpy array of type ``numpy_type``.
    ``converter_type`` tracks the generic data type produced by the converter
    function.
    Raises
    ValueError
    Raised by ``converter`` if the list elements could not be converted to
    the required type.
    """
    type_name = numpy.array([], dtype=numpy_type).dtype.name
    if ('int' in type_name):
        converter_type = IntType
    elif ('float' in type_name):
        converter_type = FloatType
    elif ('bool' in type_name):
        converter_type = BoolType
    elif ('str' in type_name):
        converter_type = StrType
    else:
        converter_type = AllType
    def bool_converter(vals):
        '\n                                Convert    values    "False"    and    "True"    to    bools.        Raise    an    exception\n                                for    any    other    string    values.\n                                '
        if (len(vals) == 0):
            return numpy.array([], dtype=bool)
        if (len(vals) > 10000):
            svals = numpy.asarray(vals[:1000])
            if (not numpy.all(((svals == 'False') | (svals == 'True')))):
                raise ValueError('bool    input    strings    must    be    only    False    or    True')
        vals = numpy.asarray(vals)
        trues = (vals == 'True')
        falses = (vals == 'False')
        if (not numpy.all((trues | falses))):
            raise ValueError('bool    input    strings    must    be    only    False    or    True')
        return trues
    def generic_converter(vals):
        return numpy.array(vals, numpy_type)
    converter = (bool_converter if (converter_type is BoolType) else generic_converter)
    return (converter, converter_type)