def line_peeker(file) ->str:
    """
    Creates a generator that reads lines from the file,
    but leaves the read position at the beginning of the
    last line read.

    :param file:    The file to read from.
    :return:        The line generator.
    """
    while True:
        pre = file.tell()
        line = file.readline()[:-1]
        post = file.tell()
        file.seek(pre)
        yield line
        file.seek(post)
