'Read until EOF using readline() and return a list of lines thus read.
If the optional sizehint argument is present, instead of reading up to EOF,
whole lines totalling approximately sizehint bytes (possibly after rounding
up to an internal buffer size) are read.
Args:
sizehint: A hint as to the maximum number of bytes to read.
Returns:
A list of strings, each being a single line from the file.'

def readlines(self, sizehint=None):

    lines = []
    while ((sizehint is None) or (sizehint > 0)):
        line = self.readline()
        if sizehint:
            sizehint -= len(line)
        if (not line):
            break
        lines.append(line)
    return lines
