code: def isStochastic(matrix):
      
      try:
          absdiff = (_np.abs(matrix.sum(axis=1) - _np.ones(matrix.shape[0])))
      except AttributeError:
          matrix = _np.array(matrix)
          absdiff = (_np.abs(matrix.sum(axis=1) - _np.ones(matrix.shape[0])))
      return (absdiff.max() <= 10*_np.spacing(_np.float64(1)))
docs: Check that ``matrix`` is row stochastic.
  
      Returns
      =======
      is_stochastic : bool
          ``True`` if ``matrix`` is row stochastic, ``False`` otherwise.