def _check_with_retries(
    condition: Callable[[], bool],
    max_attempts: int = 3,
    delay_seconds: int = 5,
) -> bool:
    """Check a condition with retries."""
    attempts = 0
    while True:
        if condition():
            return True
        attempts += 1
        if attempts >= max_attempts:
            return False
        sleep(delay_seconds)
Check a condition with retries.
python/aitemplate/compiler/ops/gemm_universal/gemm_common.py