r"""
    checks whether T is reversible in terms of given stationary distribution.
    If no distribution is given, it will be calculated out of T.

    It performs following check:
    :math:`\pi_i P_{ij} = \pi_j P_{ji}`

    Parameters
    ----------
    T : numpy.ndarray matrix
        Transition matrix
    mu : numpy.ndarray vector
        stationary distribution
    tol : float
        tolerance to check with

    Returns
    -------
    Truth value : bool
        True, if T is a reversible transitition matrix
        False, otherwise

def is_reversible(T, mu=None, tol=1e-10):
    r"""
    checks whether T is reversible in terms of given stationary distribution.
    If no distribution is given, it will be calculated out of T.

    It performs following check:
    :math:`\pi_i P_{ij} = \pi_j P_{ji}`

    Parameters
    ----------
    T : numpy.ndarray matrix
        Transition matrix
    mu : numpy.ndarray vector
        stationary distribution
    tol : float
        tolerance to check with

    Returns
    -------
    Truth value : bool
        True, if T is a reversible transitition matrix
        False, otherwise
    """
    if is_transition_matrix(T, tol):
        if mu is None:
            mu = stationary_distribution(T)
        X = mu[:, np.newaxis] * T
        return np.allclose(X, np.transpose(X),  atol=tol)
    else:
        raise ValueError("given matrix is not a valid transition matrix.")