def require_device_memory(obj):
    """A sentry for methods that accept CUDA memory object.
    """
    if not is_device_memory(obj):
        raise Exception("Not a CUDA memory object.")
A sentry for methods that accept CUDA memory object.
    
numba/cuda/cudadrv/driver.py