def read(self, length):
    length = (length + 2)
    if (length > self.length):
        self._read_from_socket((length - self.length))
    self._buffer.seek(self.bytes_read)
    data = self._buffer.read(length)
    self.bytes_read += len(data)
    if (self.bytes_read == self.bytes_written):
        self.purge()
    return data[:(- 2)]
def read(self, length):
    length = (length + 2)
    if (length > self.length):
        self._read_from_socket((length - self.length))
    self._buffer.seek(self.bytes_read)
    data = self._buffer.read(length)
    self.bytes_read += len(data)
    if (self.bytes_read == self.bytes_written):
        self.purge()
    return data[:(- 2)]