Complete work on an item from ``check_out_item()``.

        If this instance no longer owns ``item``, raise ``LostLease``.
        If ``priority`` is None, the item is removed from the queue;
        otherwise it is re-added with the specified priority.  Any
        locked items associated with this item are unlocked.

def return_item(self, item, priority):
        """Complete work on an item from ``check_out_item()``.

        If this instance no longer owns ``item``, raise ``LostLease``.
        If ``priority`` is None, the item is removed from the queue;
        otherwise it is re-added with the specified priority.  Any
        locked items associated with this item are unlocked.

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

        -- will no longer expire
        redis.call("zrem", KEYS[2], ARGV[1])
        -- update priority, readd to available list
        if ARGV[2] == "None"
        then
          redis.call("hdel", KEYS[3], ARGV[1])
        else
          redis.call("hset", KEYS[3], ARGV[1], ARGV[2])
          redis.call("zadd", KEYS[1], ARGV[2], ARGV[1])
        end
        -- release all reservations
        local reservations = redis.call("smembers", KEYS[5])
        for i = 1, #reservations do
          local item = reservations[i]
          local pri = redis.call("hget", KEYS[3], item)
          redis.call("zadd", KEYS[1], pri, item)
        end
        -- clear out workers
        redis.call("hdel", KEYS[4], "i" .. ARGV[1])
        redis.call("hdel", KEYS[4], "w" .. ARGV[3])
        
        return 0
        """)
        # work around python -> redis -> lua marshaling
        if priority is None: priority = "None"
        result = script(keys=[self._key_available(), self._key_expiration(),
                              self._key_priorities(), self._key_workers(),
                              self._key_reservations(item)],
                        args=[item, priority, self._get_worker_id(conn)])
        if result == -1: raise LostLease(item)
        return