code: def pause(self, lastGoodStep=0):
          # type: (ALastGoodStep) -> None
          
          current_state = self.state.value
          if lastGoodStep <= 0:
              last_good_step = self.completed_steps.value
          else:
              last_good_step = lastGoodStep
          if current_state == ss.RUNNING:
              next_state = ss.PAUSED
          else:
              next_state = current_state
          assert last_good_step < self.total_steps.value, \
              "Cannot seek to after the end of the scan"
          self.try_aborting_function(
              ss.SEEKING, next_state, self.do_pause, last_good_step)
docs: Pause a run() so that resume() can be called later, or seek within
          an Armed or Paused state.
  
          The original call to run() will not be interrupted by pause(), it will
          wait until the scan completes or is aborted.
  
          Normally it will return in Paused state. If the user aborts then it will
          return in Aborted state. If something goes wrong it will return in Fault
          state. If the user disables then it will return in Disabled state.