docs: def poll(
      self, lease_seconds=LEASE_SECONDS, tag=None, 
      verbose=False, execute_args=[], execute_kwargs={}, 
      stop_fn=None, backoff_exceptions=[], min_backoff_window=30, 
      max_backoff_window=120, log_fn=None
    ):
      """
      Poll a queue until a stop condition is reached (default forever). Note
      that this function is not thread safe as it requires a global variable
      to intercept SIGINT.
      lease_seconds: each task should be leased for this many seconds
      tag: if specified, query for only tasks that match this tag
      execute_args / execute_kwargs: pass these arguments to task execution
      backoff_exceptions: A list of exceptions that instead of causing a crash,
        instead cause the polling to back off for an increasing exponential 
        random window.
      min_backoff_window: The minimum sized window (in seconds) to select a 
        random backoff time. 
      max_backoff_window: The window doubles each retry. This is the maximum value
        in seconds.
      stop_fn: A boolean returning function that accepts no parameters. When
        it returns True, the task execution loop will terminate. It is evaluated
        once after every task.
      log_fn: Feed error messages to this function, default print (when verbose is enabled).
      verbose: print out the status of each step
      Return: number of tasks executed
      """
      global LOOP
  
      if not callable(stop_fn) and stop_fn is not None:
        raise ValueError("stop_fn must be a callable. " + str(stop_fn))
      elif not callable(stop_fn):
        stop_fn = lambda: False
  
      def random_exponential_window_backoff(n):
        n = min(n, min_backoff_window)
        # 120 sec max b/c on avg a request every ~250msec if 500 containers 
        # in contention which seems like a quite reasonable volume of traffic 
        # to handle
        high = min(2 ** n, max_backoff_window) 
        return random.uniform(0, high)
  
      def printv(*args, **kwargs):
        if verbose:
          print(*args, **kwargs)
  
      LOOP = True
  
      def sigint_handler(signum, frame):
        global LOOP
        printv("Interrupted. Exiting after this task completes...")
        LOOP = False
      
      prev_sigint_handler = signal.getsignal(signal.SIGINT)
      signal.signal(signal.SIGINT, sigint_handler)
  
      if log_fn is None:
        log_fn = printv
  
      tries = 0
      executed = 0
  
      backoff = False
      backoff_exceptions = tuple(list(backoff_exceptions) + [ QueueEmpty ])
  
      while LOOP:
        task = 'unknown' # for error message prior to leasing
        try:
          task = self.lease(seconds=int(lease_seconds))
          tries += 1
          printv(task)
          task.execute(*execute_args, **execute_kwargs)
          executed += 1
          printv("Delete enqueued task...")
          self.delete(task)
          log_fn('INFO', task , "succesfully executed")
          tries = 0
        except backoff_exceptions:
          backoff = True
        except Exception as e:
          printv('ERROR', task, "raised {}\n {}".format(e , traceback.format_exc()))
          raise #this will restart the container in kubernetes
          
        if stop_fn():
          break
  
        if backoff:
          time.sleep(random_exponential_window_backoff(tries))
  
        backoff = False
  
      printv("Task execution loop exited.")
      signal.signal(signal.SIGINT, prev_sigint_handler)
  
      return executed