code: def nvmlDeviceGetPersistenceMode(handle):
      r
      c_state = _nvmlEnableState_t()
      fn = _nvmlGetFunctionPointer("nvmlDeviceGetPersistenceMode")
      ret = fn(handle, byref(c_state))
      _nvmlCheckReturn(ret)
      return bytes_to_str(c_state.value)
docs: r"""
      /**
       * Retrieves the persistence mode associated with this device.
       *
       * For all products.
       * For Linux only.
       *
       * When driver persistence mode is enabled the driver software state is not torn down when the last
       * client disconnects. By default this feature is disabled.
       *
       * See \ref nvmlEnableState_t for details on allowed modes.
       *
       * @param device                               The identifier of the target device
       * @param mode                                 Reference in which to return the current driver persistence mode
       *
       * @return
       *         - \ref NVML_SUCCESS                 if \a mode has been set
       *         - \ref NVML_ERROR_UNINITIALIZED     if the library has not been successfully initialized
       *         - \ref NVML_ERROR_INVALID_ARGUMENT  if \a device is invalid or \a mode is NULL
       *         - \ref NVML_ERROR_NOT_SUPPORTED     if the device does not support this feature
       *         - \ref NVML_ERROR_GPU_IS_LOST       if the target GPU has fallen off the bus or is otherwise inaccessible
       *         - \ref NVML_ERROR_UNKNOWN           on any unexpected error
       *
       * @see nvmlDeviceSetPersistenceMode()
       */
      nvmlReturn_t DECLDIR nvmlDeviceGetPersistenceMode