'Did Inkscape reach the prompt without crashing?'

def _read_to_prompt(self):

    stream = iter(functools.partial(self._proc.stdout.read, 1), '')
    prompt = ('\n', '>')
    n = len(prompt)
    its = itertools.tee(stream, n)
    for (i, it) in enumerate(its):
        next(itertools.islice(it, i, i), None)
    while True:
        window = tuple(map(next, its))
        if (len(window) != n):
            return False
        if (self._proc.poll() is not None):
            return False
        if (window == prompt):
            return True
