code: def checkSquareStochastic(matrix):
      
      if not isSquare(matrix):
          raise _error.SquareError
      if not isStochastic(matrix):
          raise _error.StochasticError
      if not isNonNegative(matrix):
          raise _error.NonNegativeError
docs: Check if ``matrix`` is a square and row-stochastic.
  
      To pass the check the following conditions must be met:
  
      * The matrix should be square, so the number of columns equals the
        number of rows.
      * The matrix should be row-stochastic so the rows should sum to one.
      * Each value in the matrix must be positive.
  
      If the check does not pass then a mdptoolbox.util.Invalid
  
      Arguments
      ---------
      ``matrix`` : numpy.ndarray, scipy.sparse.*_matrix
          A two dimensional array (matrix).
  
      Notes
      -----
      Returns None if no error has been detected, else it raises an error.