docs: def read_matrix_sparse(filename, dtype=float, comments='#'):
      coo = np.loadtxt(filename, comments=comments, dtype=dtype)
  
      """Check if coo is (M, 3) ndarray"""
      if len(coo.shape) == 2 and coo.shape[1] == 3:
          row = coo[:, 0]
          col = coo[:, 1]
          values = coo[:, 2]
  
          """Check if imaginary part of row and col is zero"""
          if np.all(np.isreal(row)) and np.all(np.isreal(col)):
              row = row.real
              col = col.real
  
              """Check if first and second column contain only integer entries"""
              if np.all(is_integer(row)) and np.all(is_integer(col)):
  
                  """Convert row and col to int"""
                  row = row.astype(int)
                  col = col.astype(int)
  
                  """Create coo-matrix"""
                  A = scipy.sparse.coo_matrix((values, (row, col)))
                  return A
              else:
                  raise ValueError('File contains non-integer entries for row and col.')
          else:
              raise ValueError('File contains complex entries for row and col.')
      else:
          raise ValueError('Given file is not a sparse matrix in coo-format.')