'Read and return up to n bytes.
Returns an empty bytes object on EOF, or None if the object is
set not to block and has no data to read.'

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

    if (n is None):
        n = (-1)
    if (n < 0):
        return self.readall()
    b = bytearray(n.__index__())
    n = self.readinto(b)
    if (n is None):
        return None
    del b[n:]
    return bytes(b)
