def from_ctypes(ctypeobj):
    """
    Convert the given ctypes type to a Numba type.
    """
    if ctypeobj is None:
        # Special case for the restype of void-returning functions
        return types.none

    assert isinstance(ctypeobj, type), ctypeobj

    def _convert_internal(ctypeobj):
        # Recursive helper
        if issubclass(ctypeobj, ctypes._Pointer):
            valuety = _convert_internal(ctypeobj._type_)
            if valuety is not None:
                return types.CPointer(valuety)
        else:
            return _FROM_CTYPES.get(ctypeobj)

    ty = _convert_internal(ctypeobj)
    if ty is None:
        raise TypeError("Unsupported ctypes type: %s" % ctypeobj)
    return ty

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