Here's my solution, I got error on line 79, but my solution only has 35 lines. Is this a bug?

```
# The read4 API is already defined for you.
# @param buf, a list of characters
# @return an integer
# def read4(buf):
class Solution:
BUF = [0, 0, 0, 0]
NUM = 4
# @param buf, Destination buffer (a list of characters)
# @param n, Maximum number of characters to read (an integer)
# @return The number of characters read (an integer)
def read(self, buf, n):
sofar = 0
# copy from BUF
for i in range(Solution.NUM, min(4, Solution.NUM+n)):
buf[i-Solution.NUM] = Solution.BUF[i]
sofar += max(0, min(4, Solution.NUM+n)-Solution.NUM)
if sofar == n:
return sofar
numRead = read4(Solution.BUF)
while numRead != 0 and sofar < n:
if numRead+sofar >= n:
for i in range(n-sofar):
buf[sofar+i] = Solution.BUF[i]
Solution.NUM = n-sofar
return n
for i in range(numRead):
buf[sofar+i] = Solution.BUF[i]
sofar += numRead
numRead = read4(Solution.BUF)
return sofar
```