code: def _run_expiration(self, conn):
          
          # The logic here is sufficiently complicated, and we need
          # enough random keys (Redis documentation strongly encourages
          # not constructing key names in scripts) that we'll need to
          # do this in multiple steps.  This means that, when we do
          # go in and actually expire things, we need to first check
          # that they're still running.
  
          # Get, and clear out, the list of expiring items
          now = time.time()
          script = conn.register_script("""
          local result = redis.call("zrangebyscore", KEYS[1], 0, ARGV[1])
          redis.call("zremrangebyscore", KEYS[1], 0, ARGV[1])
          return result
          """)
          expiring = script(keys=[self._key_expiration()], args=[time.time()])
          
          # Manually expire each item one by one
          script = conn.register_script("""
          -- item may have fallen out of the worker list, if someone finished
          -- at just the very last possible moment (phew!)
          local wworker = redis.call("hget", KEYS[3], "i" .. ARGV[1])
          if not wworker then return end
  
          -- we want to return item, plus everything it's reserved
          local to_return = redis.call("smembers", KEYS[4])
          to_return[#to_return + 1] = ARGV[1]
          for i = 1, #to_return do
            local pri = redis.call("hget", KEYS[2], to_return[i])
            redis.call("zadd", KEYS[1], pri, to_return[i])
          end
          -- already removed from expiration list
          -- remove from worker list too
          redis.call("hdel", KEYS[3], "i" .. ARGV[1])
          redis.call("hdel", KEYS[3], wworker)
          """)
          for item in expiring:
              script(keys=[self._key_available(), self._key_priorities(),
                           self._key_workers(), self._key_reservations(item)],
                     args=[item])
docs: Return any items that have expired.