import time


def _terminal_test_wait(fn, value):
    """
    Waits for file named <fn> to contain <value>.
    Returns True on success, False on timeout.
    """
    value = str(value)
    timer = 0
    interval = 0.5
    while timer < 10:
        time.sleep(interval)
        try:
            with open(fn, 'r') as f:
                if value == f.read().strip():
                    return True
        except:
            pass
        timer += interval
    return False