def contiguity_check(arg_name):
    return """
    if (!CudaNdarray_is_c_contiguous(%%(%(arg_name)s)s))
    {
        PyErr_SetString(PyExc_ValueError,
            "%%(class_name)s: %(arg_name)s must be C contiguous");
        %%(fail)s;
    }
    """ % locals()
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/sandbox/cuda_convnet/code_templates.py/contiguity_check/original