code: def _daal4py_kmeans_compatibility(
      nClusters,
      maxIterations,
      fptype="double",
      method="lloydDense",
      accuracyThreshold=0.0,
      resultsToEvaluate="computeCentroids",
      gamma=1.0,
  ):
      kmeans_algo = None
      if daal_check_version(((2020, "P", 2), (2021, "B", 107))):
          kmeans_algo = daal4py.kmeans(
              nClusters=nClusters,
              maxIterations=maxIterations,
              fptype=fptype,
              resultsToEvaluate=resultsToEvaluate,
              accuracyThreshold=accuracyThreshold,
              method=method,
              gamma=gamma,
          )
      else:
          assigFlag = "computeAssignments" in resultsToEvaluate
          kmeans_algo = daal4py.kmeans(
              nClusters=nClusters,
              maxIterations=maxIterations,
              fptype=fptype,
              assignFlag=assigFlag,
              accuracyThreshold=accuracyThreshold,
              method=method,
              gamma=gamma,
          )
      return kmeans_algo
  
imports: import numpy
  from scipy import sparse
  from sklearn.utils import check_array, check_random_state
  from sklearn.utils.sparsefuncs import mean_variance_axis
  from sklearn.utils.validation import _num_samples, check_is_fitted
  import warnings
  from sklearn.cluster import KMeans
  from sklearn.utils.extmath import row_norms
  import daal4py
  from .._device_offload import support_usm_ndarray
  from .._utils import PatchingConditionsChain, control_n_jobs, daal_check_version, getFPType, run_with_n_jobs
label_desc: Use image node_id 3 for calling a global function with example usage: _daal4py_kmeans_compatibility(nClusters, maxIterations, fptype, method, accuracyThreshold, resultsToEvaluate, gamma) and returns: kmeans_algo