def poll_for_result(
    f: Callable[[], T], exception=Exception, max_attempts=5, seconds_between_attempts=1
) -> T:
    """Poll for a result from a function.

    Args:
        f: function to call
        exception: exception to catch
        max_attempts: maximum number of attempts
        seconds_between_attempts: seconds to wait between

    Returns:
        Result of the function

    Raises:
        AssertionError: if the function does not return a value
    """
    attempts = 0
    while attempts < max_attempts:
        try:
            return f()
        except exception:
            attempts += 1
            time.sleep(seconds_between_attempts)
    msg = "Function did not return a value"
    raise AssertionError(msg)
Poll for a result from a function.

    Args:
        f: function to call
        exception: exception to catch
        max_attempts: maximum number of attempts
        seconds_between_attempts: seconds to wait between

    Returns:
        Result of the function

    Raises:
        AssertionError: if the function does not return a value
    
tests/integration/test_dynamic_components.py