code: def _maybe_resample(self):
          
          ess = self.n_ess
          if ess <= 10:
              warnings.warn(
                  "Extremely small n_ess encountered ({}). "
                  "Resampling is likely to fail. Consider adding particles, or "
                  "resampling more often.".format(ess),
                  ApproximationWarning
              )
          if ess < self.n_particles * self.resample_thresh:
              self.resample()
              pass
docs: Checks the resample threshold and conditionally resamples.