def METHOD_NAME(self, timeout):
    if self._stop_requested:
        raise StopRequested()
    result = None
    while True:
        if self._stop_requested:
            raise StopRequested()
        self.heartbeat()
        if self.gevent_pool.full():
            self.set_state(WorkerStatus.BUSY)
            self.log.warning(
                "RQ GEVENT worker greenlet pool empty current size %s",
                self.gevent_pool.size,
            )
        while self.gevent_pool.full():
            gevent.sleep(0.1)
            if self._stop_requested:
                raise StopRequested()
        try:
            result = self.queue_class.dequeue_any(
                self.queues, timeout, connection=self.connection
            )
            self.set_state(WorkerStatus.IDLE)
            if result is not None:
                job, queue = result
                self.log.info(
                    "%s: %s (%s)"
                    % (green(queue.name), blue(job.description), job.id)
                )
            break
        except DequeueTimeout:
            pass
    self.heartbeat()
    return result