'Read `size` bytes or if size is not provided everything is read.
:param size: the number of bytes read.'

def read(self, size=None):

    if (self._pos >= self.limit):
        return self.on_exhausted()
    if ((size is None) or (size == (-1))):
        size = self.limit
    to_read = min((self.limit - self._pos), size)
    try:
        read = self._read(to_read)
    except (IOError, ValueError):
        return self.on_disconnect()
    if (to_read and (len(read) != to_read)):
        return self.on_disconnect()
    self._pos += len(read)
    return read
