'Return a list of lines from the stream.
hint can be specified to control the number of lines read: no more
lines will be read if the total size (in bytes/characters) of all
lines so far exceeds hint.'

def readlines(self, hint=None):

    if ((hint is not None) and (not isinstance(hint, (int, long)))):
        raise TypeError(u'integer    or    None    expected')
    if ((hint is None) or (hint <= 0)):
        return list(self)
    else:
        n = 0
        lines = []
        for line in self:
            lines.append(line)
            n += len(line)
            if (n >= hint):
                break
        return lines
