'Read and return up to n bytes.
If the argument is omitted, None, or negative, data is read and returned until EOF is reached..'

def read(self, n=(-1)):

    buf = ''
    if (n is None):
        n = (-1)
    while True:
        if (n < 0):
            data = self.read1(n)
        elif (n > len(buf)):
            data = self.read1((n - len(buf)))
        else:
            return buf
        if (len(data) == 0):
            return buf
        buf += data
    return
