code: def approximate_mode(class_counts, n_draws, rng):
      """Computes approximate mode of multivariate hypergeometric.
      This is an approximation to the mode of the multivariate
      hypergeometric given by class_counts and n_draws.
      It shouldn't be off by more than one.
      It is the mostly likely outcome of drawing n_draws many
      samples from the population given by class_counts.
      Args
      ----------
      class_counts : ndarray of int
          Population per class.
      n_draws : int
          Number of draws (samples to draw) from the overall population.
      rng : random state
          Used to break ties.
      Returns
      -------
      sampled_classes : ndarray of int
          Number of samples drawn from each class.
          np.sum(sampled_classes) == n_draws
  
      """
      # this computes a bad approximation to the mode of the
      # multivariate hypergeometric given by class_counts and n_draws
      continuous = n_draws * class_counts / class_counts.sum()
      # floored means we don't overshoot n_samples, but probably undershoot
      floored = np.floor(continuous)
      # we add samples according to how much "left over" probability
      # they had, until we arrive at n_samples
      need_to_add = int(n_draws - floored.sum())
      if need_to_add > 0:
          remainder = continuous - floored
          values = np.sort(np.unique(remainder))[::-1]
          # add according to remainder, but break ties
          # randomly to avoid biases
          for value in values:
              (inds,) = np.where(remainder == value)
              # if we need_to_add less than what's in inds
              # we draw randomly from them.
              # if we need to add more, we add them all and
              # go to the next value
              add_now = min(len(inds), need_to_add)
              inds = rng.choice(inds, size=add_now, replace=False)
              floored[inds] += 1
              need_to_add -= add_now
              if need_to_add == 0:
                  break
      return floored.astype(np.int64)
  
label_desc: Use image node_id 1 for calling a global function with example usage: approximate_mode(class_counts, n_draws, rng) and returns: floored