<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_stationarity(self, tolerance=0.2, sample=None):
 """ Checks if the given markov chain is stationary and checks the steady state probablity values for the state are consistent. Parameters: tolerance: float represents the diff between actual steady state value and the computed value sample: [State(i,j)] represents the list of state which the markov chain has sampled Return Type: Boolean True, if the markov chain converges to steady state distribution within the tolerance False, if the markov chain does not converge to steady state distribution within tolerance Examples: --------- True """

        keys = self.transition_models.keys()
        return_val = True
        for k in keys:
            # convert dict to numpy matrix
            transition_mat = np.array([np.array(list(self.transition_models[k][i].values()))
                                       for i in self.transition_models[k].keys()], dtype=np.float)
            S, U = eig(transition_mat.T)
            stationary = np.array(U[:, np.where(np.abs(S - 1.) < 1e-8)[0][0]].flat)
            stationary = (stationary / np.sum(stationary)).real

            probabilites = []
            window_size = 10000 if sample is None else len(sample)
            for i in range(0, transition_mat.shape[0]):
                probabilites.extend(self.prob_from_sample([State(k, i)], window_size=window_size))
            if any(np.abs(i) > tolerance for i in np.subtract(probabilites, stationary)):
                return_val = return_val and False
            else:
                return_val = return_val and True

        return return_val