code: def isNonNegative(matrix):
      
      try:
          if (matrix >= 0).all():
              return True
      except (NotImplementedError, AttributeError, TypeError):
          try:
              if (matrix.data >= 0).all():
                  return True
          except AttributeError:
              matrix = _np.array(matrix)
              if (matrix.data >= 0).all():
                  return True
      return False
docs: Check that ``matrix`` is row non-negative.
  
      Returns
      =======
      is_stochastic : bool
          ``True`` if ``matrix`` is non-negative, ``False`` otherwise.