code: def _sklearn_cohen_kappa_multiclass(
      preds, target, weights, ignore_index=None
  ):
      preds = preds.numpy()
      target = target.numpy()
      if np.issubdtype(preds.dtype, np.floating):
          preds = np.argmax(preds, axis=1)
      preds = preds.flatten()
      target = target.flatten()
      target, preds = remove_ignore_index(target, preds, ignore_index)
      return sk_cohen_kappa(y1=target, y2=preds, weights=weights)
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import cohen_kappa_score
  from torchmetrics.classification.cohen_kappa import BinaryCohenKappa, CohenKappa, MulticlassCohenKappa
  from torchmetrics.functional.classification.cohen_kappa import binary_cohen_kappa, multiclass_cohen_kappa
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES, THRESHOLD
  from unittests.classification.inputs import _binary_cases, _multiclass_cases
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester, inject_ignore_index, remove_ignore_index
label_desc: Use image node_id 2 for calling a global function with example usage: _sklearn_cohen_kappa_multiclass(preds, target, weights, ignore_index) and returns: sk_cohen_kappa