Empirically determine the steady state probabilities from a stochastic matrix

def steadystate(A, max_iter=100):
    """
    Empirically determine the steady state probabilities from a stochastic matrix
    """
    P = np.linalg.matrix_power(A, max_iter)

    # Determine the unique rows in A
    v = []
    for i in range(len(P)):
        if not np.any([np.allclose(P[i], vi, ) for vi in v]):
            v.append(P[i])

    return normalize(np.sum(v, axis=0))