'Normalize `X` array so it sums to 1.0 over the `axis`.
Parameters
X : array
Array to normalize.
axis : optional int
Axis over which the resulting array sums to 1.
out : optional array
Output array of the same shape as X.'

@classmethod
def _normalize(cls, X, axis=None, out=None):

    X = np.asarray(X, dtype=float)
    scale = np.sum(X, axis=axis, keepdims=True)
    if (out is None):
        return (X / scale)
    else:
        if (out is not X):
            assert (out.shape == X.shape)
            out[:] = X
        out /= scale
        return out
