code: def test_cohen_kappa_serialization():
      actuals = np.array([4, 4, 3, 3, 2, 2, 1, 1], dtype=np.int32)
      preds = np.array([1, 2, 4, 1, 3, 3, 4, 4], dtype=np.int32)
      weights = np.array([1, 1, 2, 5, 10, 2, 3, 3], dtype=np.int32)
  
      ck = CohenKappa(
          num_classes=5, sparse_labels=True, weightage="quadratic"
      )
      check_metric_serialization(ck, actuals, preds, weights)
  
imports: import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.metrics import CohenKappa
  from tensorflow_addons.testing.serialization import check_metric_serialization
label_desc: Use image node_id 18 for calling a global function with example usage: test_cohen_kappa_serialization() without return types