'Read until EOF using readline() and return a list containing the 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.'

def readlines(self, *sizehint):

    result = []
    total_read = 0
    while ((sizehint == ()) or (total_read < sizehint[0])):
        line = self.readline()
        if (line == ''):
            break
        total_read = (total_read + len(line))
        result.append(line)
    return result
