'Returns the current context or push/create a context for the GPU
with the given device number.'

def get_or_create_context(self, devnum):

    if self.context_stack:
        return self.current_context
    else:
        with self._lock:
            return self.push_context(self.gpus[devnum])
