def reserve_items(self, parent_item, *items):
        """Reserve a set of items until a parent item is returned.

        Prevent ``check_out_item()`` from returning any of ``items``
        until ``parent_item`` is completed or times out.  For each
        item, if it is not already checked out or reserved by some
        other parent item, it is associated with ``parent_item``, and
        the reservation will be released when ``parent_item``
        completes or times out.  Returns a list that is a subset of
        ``items`` for which we could get the reservation.

        Raises ``LostLease`` if this queue instance no longer owns
        ``parent_item``.  If any of the items do not exist, they are
        silently ignored.

        """
        conn = redis.StrictRedis(connection_pool=self.pool)
        self._run_expiration(conn)
        script = conn.register_script("""
        -- expired?
        if redis.call("hget", KEYS[2], "i" .. ARGV[1]) ~= "w" .. ARGV[2]
        then return -1 end

        -- loop through each item
        local result = {}
        for i = 3, #ARGV do
          local item = ARGV[i]
          -- item must be available to reserve
          if redis.call("zscore", KEYS[1], item) then
            redis.call("zrem", KEYS[1], item)
            redis.call("sadd", KEYS[3], item)
            result[#result + 1] = item
          end
        end
        return result
        """)
        result = script(keys=[self._key_available(), self._key_workers(),
                              self._key_reservations(parent_item)],
                        args=([parent_item, self._get_worker_id(conn)] +
                              list(items)))
        if result == -1:
            raise LostLease(parent_item)
        return result
Reserve a set of items until a parent item is returned.

        Prevent ``check_out_item()`` from returning any of ``items``
        until ``parent_item`` is completed or times out.  For each
        item, if it is not already checked out or reserved by some
        other parent item, it is associated with ``parent_item``, and
        the reservation will be released when ``parent_item``
        completes or times out.  Returns a list that is a subset of
        ``items`` for which we could get the reservation.

        Raises ``LostLease`` if this queue instance no longer owns
        ``parent_item``.  If any of the items do not exist, they are
        silently ignored.