code: def pause(self):
          
          self.status = 'paused'
          # The _loop method will react to 'paused' status and stop looping.
          if hasattr(
                  self, '_sampling_thread') and self._sampling_thread.isAlive():
              print_('Waiting for current iteration to finish...')
              while self._sampling_thread.isAlive():
                  sleep(.1)
docs: Pause the sampler. Sampling can be resumed by calling `icontinue`.