def list_expired_reservations(self, expiration_time):
        expiration_timestamp = time.mktime(expiration_time.timetuple()) + expiration_time.microsecond / 1e6
        client = self._redis_maker()
        
        # This is not a problem in SQL, since we say "retrieve only those that have expired"
        # However, I simply don't know how to say that in redis, even using expire or expireat. 
        # The only way I can think of is to check the whole table of reservations. So we have
        # established a mechanism based on expiration to avoid performing this more than once per
        # second

        acquired = client.hset(WEBLAB_RESERVATIONS_LOCK, "locked", 1)
        if not acquired and not is_testing():
            # When testing, we want to avoid that two calls return different results, so 
            # we ignore the mechanism
            return []

        client.expire(WEBLAB_RESERVATIONS_LOCK, 1) # Every second

        reservation_ids = client.smembers(WEBLAB_RESERVATIONS)
        
        pipeline = client.pipeline()
        for reservation_id in reservation_ids:
            weblab_reservation_status = WEBLAB_RESERVATION_STATUS % reservation_id
            pipeline.hget(weblab_reservation_status, LATEST_ACCESS)

        expired_reservation_ids = []
        for reservation_id, latest_access_str in zip(reservation_ids, pipeline.execute()):
            if latest_access_str is None:
                continue
            latest_access = float(latest_access_str)
            if latest_access is not None and latest_access < expiration_timestamp:
                expired_reservation_ids.append(reservation_id)

        return expired_reservation_ids
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/core/coordinator/redis/reservations_manager.py/ReservationsManager.list_expired_reservations/original