code: def _get_centers(
      rs, centers, center_box, n_samples, n_features, dtype
  ):
      if isinstance(n_samples, numbers.Integral):
          # Set n_centers by looking at centers arg
          if centers is None:
              centers = 3
  
          if isinstance(centers, numbers.Integral):
              n_centers = centers
              centers = rs.uniform(
                  center_box[0],
                  center_box[1],
                  size=(n_centers, n_features),
                  dtype=dtype,
              )
  
          else:
              if n_features != centers.shape[1]:
                  raise ValueError(
                      "Expected `n_features` to be equal to"
                      " the length of axis 1 of centers array"
                  )
              n_centers = centers.shape[0]
  
      else:
          # Set n_centers by looking at [n_samples] arg
          n_centers = len(n_samples)
          if centers is None:
              centers = rs.uniform(
                  center_box[0],
                  center_box[1],
                  size=(n_centers, n_features),
                  dtype=dtype,
              )
          try:
              assert len(centers) == n_centers
          except TypeError:
              raise ValueError(
                  "Parameter `centers` must be array-like. "
                  "Got {!r} instead".format(centers)
              )
          except AssertionError:
              raise ValueError(
                  "Length of `n_samples` not consistent"
                  " with number of centers. Got n_samples = {} "
                  "and centers = {}".format(n_samples, centers)
              )
          else:
              if n_features != centers.shape[1]:
                  raise ValueError(
                      "Expected `n_features` to be equal to"
                      " the length of axis 1 of centers array"
                  )
  
      return centers, n_centers
  
imports: import numbers
  import cuml.internals
  from collections.abc import Iterable
  from cuml.internals.safe_imports import gpu_only_import
  from cuml.datasets.utils import _create_rs_generator
  from cuml.internals.safe_imports import cpu_only_import, gpu_only_import_from, null_decorator
label_desc: Use image node_id 1 for calling a global function with example usage: _get_centers(rs, centers, center_box, n_samples, n_features, dtype) and returns: centers,  n_centers