def QueryAndOwn(self, queue, lease_seconds=10, limit=1):
    user = ""
    if self.token:
      user = self.token.username
    # Do the real work in a transaction
    try:
      res = self.data_store.RetryWrapper(
          queue, self._QueryAndOwn, lease_seconds=lease_seconds, limit=limit,
          token=self.token, user=user)

      return res
    except data_store.TransactionError:
      # This exception just means that we could not obtain the lock on the queue
      # so we just return an empty list, let the worker sleep and come back to
      # fetch more tasks.
      return []
    except data_store.Error as e:
      logging.warning("Datastore exception: %s", e)
      return []
Returns a list of Tasks leased for a certain time.
dataset/ETHPy150Open google/grr/grr/lib/queue_manager.py/QueueManager.QueryAndOwn