code: def _MStep(x, z, k):
      """Computation of cluster centers/means
  
      Parameters
      ----------
      x array of shape (n,p)
        where n = number of samples, p = data dimension
      z, array of shape (x.shape[0]) current assignment
      k, int, number of desired clusters
  
      Returns
      -------
      centers, array of shape (k,p)
               the resulting centers
      """
      dim = x.shape[1]
      centers = np.repeat(np.reshape(x.mean(0), (1, dim)), k, 0)
      for q in range(k):
          if np.sum(z == q) == 0:
              pass
          else:
              centers[q] = np.mean(x[z == q], 0)
      return centers
  
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _MStep(x, z, k) and returns: centers