docs: def normalize(A, axis=None, inplace=False):
      """
      Normalize the input array so that it sums to 1.
  
      Parameters
      ----------
      A: array, shape (n_samples, n_features)
          Non-normalized input data.
      axis: int
          Dimension along which normalization is performed.
  
      Returns
      -------
      normalized_A: array, shape (n_samples, n_features)
          A with values normalized (summing to 1) along the prescribed axis
      """
      if not inplace:
          A = A.copy()
  
      A += np.finfo(float).eps
      Asum = A.sum(axis)
      if axis and A.ndim > 1:
          # Make sure we don't divide by zero.
          Asum[Asum == 0] = 1
          shape = list(A.shape)
          shape[axis] = 1
          Asum.shape = shape
      A /= Asum
      return A