code: def wait_redis_ping(db: Database, timeout: int = 30):
      """Wait when redis.ping return True
  
      Args:
          db (Database): redis db object
          timeout (int): seconds to wait for success ping
  
      Raises:
          RedisConnectionError: if `ping` did not return `True` within `timeout` seconds
      """
      end_time = time.time() + timeout
      while time.time() <= end_time:
          try:
              if db.ping() is True:
                  break
          except RedisConnectionError:
              pass
          time.sleep(2)
      else:
          raise RedisConnectionError
  
imports: import time
  import pickle
  import socket
  import threading
  from walrus import Database
  from redis.exceptions import ConnectionError
  from mindsdb.utilities.context import context
  from mindsdb.utilities.ml_task_queue.const import ML_TASK_STATUS
label_desc: Use image node_id 3 for calling a global function with example usage: wait_redis_ping(db, timeout) without return types