code: def reset(resources, *args, **kwargs):
      
      test = kwargs.pop('test', False)
      client = redis.Redis(decode_responses=True, **kwargs)
      resources = resources if resources else find_resources(client)
  
      for resource in resources:
          # investigate sequences
          queue = Queue(client=client, resource=resource)
          values = client.mget(queue.keys.indicator, queue.keys.dispenser)
          try:
              indicator, dispenser = map(int, values)
          except TypeError:
              print('No such queue: "{}".'.format(resource))
              continue
  
          # do a bump if there appears to be a queue
          if dispenser - indicator + 1:
              queue.message('Reset tool bumps.')
              indicator = queue.bump()
  
          # do not reset when there is still a queue
          size = dispenser - indicator + 1
          if size:
              print('"{}" is in use by {} user(s).'.format(resource, size))
              continue
  
          # reset, except when someone is incoming
          with client.pipeline() as pipe:
              try:
                  pipe.watch(queue.keys.dispenser)
                  if test:
                      time.sleep(0.02)
                  pipe.multi()
                  pipe.delete(queue.keys.dispenser, queue.keys.indicator)
                  pipe.execute()
              except redis.WatchError:
                  print('Activity detected for "{}".'.format(resource))
docs: Remove dispensers and indicators for idle resources.