code: def isample(self, *args, **kwds):
          
          self._exc_info = None
          out = kwds.pop('out', sys.stdout)
          kwds['progress_bar'] = False
  
          def samp_targ(*args, **kwds):
              try:
                  self.sample(*args, **kwds)
              except:
                  self._exc_info = sys.exc_info()
  
          self._sampling_thread = Thread(
              target=samp_targ,
              args=args,
              kwargs=kwds)
          self.status = 'running'
          self._sampling_thread.start()
          self.iprompt(out=out)
docs: Samples in interactive mode. Main thread of control stays in this function.