from typing import Callable
import time


def wait_for(fn: Callable[[], None], max_tries: int = 60, delay: float = 0.1) -> None:
    """Wait for a function call success

    The given `fn` argument should:

        1. Raise `AssertionError` for the case condition not meet and continue to wait.
        2. Return `None` for success (meet condition)
    """

    tries = 0
    while True:
        tries += 1
        try:
            return fn()
        except AssertionError as e:
            if tries >= max_tries:
                raise e
            time.sleep(delay)