def readlines(self, sizehint=0):
        """Read a list of lines from file, counting bytes."""
        # Shamelessly stolen from StringIO
        total = 0
        lines = []
        line = self.readline()
        while line:
            lines.append(line)
            total += len(line)
            if 0 < sizehint <= total:
                break
            line = self.readline()
        return lines
Read a list of lines from file, counting bytes.
cherrypy/lib/cpstats.py