from typing import Callable
import time


def wait_for_it(condition: Callable[..., bool], max_wait=5) -> bool:
    """Waits for up to ``max_wait`` seconds for ``condition`` to be truthy.

    :returns: ``True`` if condition, else ``False``
    """
    start = time.time()
    while not condition() and (time.time() - start) <= max_wait:
        time.sleep(0.1)
    return bool(condition())