code: def test_kmeans_lookup(self, weightShape, dtype):
      nbits = 4
      w = np.random.rand(*weightShape).astype(dtype)
  
      (
          lookup_table,
          quantized_weights,
      ) = quantization_utils._get_kmeans_lookup_table_and_weight(
          nbits, w
      )
  
      assert len(lookup_table) == 2**nbits
      assert quantized_weights.shape == (np.prod(weightShape),)
      assert len(np.unique(quantized_weights)) <= len(lookup_table)
  
      quantized_weight_values = lookup_table[quantized_weights]
      max_deltas = np.abs(
          w.flatten() - quantized_weight_values.flatten()
      ).max()
      assert max_deltas < 0.1
  
imports: import itertools
  import unittest
  import numpy
  import pytest
  import coremltools
  import coremltools.models.datatypes
  from coremltools import ComputeUnit
  from coremltools.models import _QUANTIZATION_MODE_LINEAR_QUANTIZATION, neural_network
  from coremltools.models.neural_network import quantization_utils
  from coremltools.models.neural_network.quantization_utils import MatrixMultiplyLayerSelector, _quantize_spec_weights, activate_int8_int8_matrix_multiplications
label_desc: Use image node_id 1 for calling the TestKMeansLookup obj's underlying member method code with example usage: obj.test_kmeans_lookup(weightShape, dtype) without return types