'Get current active context in CUDA driver runtime.
Note: Lowlevel calls that returns the handle.'

def get_context(self):

    handle = drvapi.cu_context(0)
    driver.cuCtxGetCurrent(byref(handle))
    if (not handle.value):
        return None
    return handle
