code: def waitReadiness(container, timeout=30):
      threshold = time.time() + timeout
      ready_msg = "database system is ready to accept connections"
      while True:
          lines = container.logs().decode()
          # container fully ready
          # because it reloads the db server during initialization
          # need to check that the 'ready for connections' has found second time
          if lines.count(ready_msg) > 1:
              break
          if time.time() > threshold:
              raise Exception(
                  "timeout exceeded, container is still not ready"
              )
  
file_path: mindsdb/tests/handler_tests/test_postgres_handler.py
imports: import time
  import pytest
  import docker
  from mindsdb.integrations.handlers.postgres_handler.postgres_handler import PostgresHandler
  from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
label_desc: Use image node_id 1 for calling a global function with example usage: waitReadiness(container, timeout) without return types