code: def check_migrations(timeout):
      """
      Wait for all airflow migrations to complete.
  
      :param timeout: Timeout for the migration in seconds
      :return: None
      """
      timeout = timeout or 1  # run the loop at least 1
      with _configured_alembic_environment() as env:
          context = env.get_context()
          source_heads = None
          db_heads = None
          for ticker in range(timeout):
              source_heads = set(env.script.get_heads())
              db_heads = set(context.get_current_heads())
              if source_heads == db_heads:
                  return
              time.sleep(1)
              log.info("Waiting for migrations... %s second(s)", ticker)
          raise TimeoutError(
              f"There are still unapplied migrations after {timeout} seconds. Migration"
              f"Head(s) in DB: {db_heads} | Migration Head(s) in Source Code: {source_heads}"
          )
  
imports: from __future__ import annotations
  import contextlib
  import enum
  import json
  import logging
  import os
  import sys
  import time
  import warnings
  from dataclasses import dataclass
  from tempfile import gettempdir
  from typing import TYPE_CHECKING, Callable, Generator, Iterable
  from sqlalchemy import Table, and_, column, delete, exc, func, inspect, literal, or_, select, table, text, tuple_
  import airflow
  from airflow import settings
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException
  from airflow.models import import_all_models
  from airflow.utils import helpers
  from airflow.utils.session import NEW_SESSION, create_session, provide_session
label_desc: Use image node_id 11 for calling a global function with example usage: check_migrations(timeout) without return types