docs: def fit_cluster(data, assignments, k, P_init, R_init, means):
      """
      Fits NB/poisson params to a cluster.
      """
      for c in range(k):
          if data[:,assignments==c].shape[1] == 0:
              _, assignments = kmeans_pp(data, k)
      genes, cells = data.shape
      nb_gene_indices = np.array([True for i in range(genes)])
      for c in range(k):
          c_data = data[:,assignments==c]
          nb_gene_indices = nb_gene_indices & find_nb_genes(c_data)
      for c in range(k):
          c_data = data[:,assignments==c]
          nb_genes = c_data[nb_gene_indices,:]
          poisson_genes = c_data[~nb_gene_indices, :]
          P_init[nb_gene_indices, c], R_init[nb_gene_indices, c] = nb_fit(nb_genes)
          means[~nb_gene_indices, c] = poisson_genes.mean(1)
      return nb_gene_indices