def readlines(file):
    """This is a generator that produces every line of the passed file object
    using readline(). The difference between using readlines() and simply
    iterating over the file object is that the latter fills a hidden buffer
    from which it dispenses its lines. readlines() makes individual calls to
    the file object's readline() method to retrieve exactly one line at a
    time. This matters when reading output from a subprocess; readlines()
    displays that output in something approaching real time, whereas iterating
    over the file object waits to fill its buffer before displaying any
    output. The more slowly the subprocess produces output, the more
    exasperating the buffer delay.
    """
    line = file.readline()
    while line:
        yield line
        line = file.readline()
