code: def ess(sim, n):
      
      try:
          ess = _chains.effective_sample_size(sim, n)
      except (ValueError, ZeroDivisionError):
          ess = nan
      return ess
docs: Calculate effective sample size
  
      Parameters
      ----------
      sim : chains
      n : int
          Parameter index starting from 0