code: def predictive_check(obs_vals, obs_mesh, M, posdef_indices, tolerance):
      
  
      non_posdef_indices = array(
          list(set(range(len(obs_vals))) - set(posdef_indices)), dtype=int)
      if len(non_posdef_indices) > 0:
          M_under = M(obs_mesh[non_posdef_indices, :]).ravel()
          dev = abs((M_under - obs_vals[non_posdef_indices]))
          if dev.max() > tolerance:
              return False
  
      return True
docs: OK = predictive_check(obs_vals, obs_mesh, M, posdef_indices, tolerance)
  
  
      If an internal covariance is low-rank, make sure the observations
      are consistent. Returns True if good, False if bad.
  
  
      :Arguments:
  
          -   `obs_vals`: The observed values.
  
          -   `obs_mesh`: The mesh on which the observed values were observed.
  
          -   `M`: The mean function, observed at obs_vals[posdef_indices].
  
          -   `tolerance`: The maximum allowable deviation at M(obs_mesh[non_posdef_indices]).