code: def _loop(self):
          
          self.status = 'running'
  
          try:
              while self._current_iter < self._iter and not self.status == 'halt':
                  if self.status == 'paused':
                      break
  
                  i = self._current_iter
  
                  self.draw()
                  self.tally()
  
                  if not i % 10000 and self.verbose > 0:
                      print_('Iteration ', i, ' of ', self._iter)
                      sys.stdout.flush()
  
                  self._current_iter += 1
  
          except KeyboardInterrupt:
              self.status = 'halt'
  
          if self.status == 'halt':
              self._halt()
docs: _loop(self, *args, **kwargs)
  
          Can be called after a sampling run is interrupted (by pausing, halting or a
          KeyboardInterrupt) to continue the sampling run.
  
          _loop must be able to handle KeyboardInterrupts gracefully, and should monitor
          the sampler's status periodically. Available status values are:
          - 'ready': Ready to sample.
          - 'paused': A pause has been requested, or the sampler is paused. _loop should return control
              as soon as it is safe to do so.
          - 'halt': A halt has been requested, or the sampler is stopped. _loop should call halt as soon
              as it is safe to do so.
          - 'running': Sampling is in progress.