def to_ctypes(ty):
    """
    Convert the given Numba type to a ctypes type.
    """
    assert isinstance(ty, types.Type), ty

    if ty is types.none:
        # Special case for the restype of void-returning functions
        return None

    def _convert_internal(ty):
        if isinstance(ty, types.CPointer):
            return ctypes.POINTER(_convert_internal(ty.dtype))
        else:
            return _TO_CTYPES.get(ty)

    ctypeobj = _convert_internal(ty)
    if ctypeobj is None:
        raise TypeError("Cannot convert Numba type '%s' to ctypes type"
                        % (ty,))
    return ctypeobj

    Convert the given Numba type to a ctypes type.
    
numba/core/typing/ctypes_utils.py