'Read data from the underlying file.
If you ask for too much or there isn\'t anything left,
this will raise an InputStreamExhausted error.'

def read(self, num_bytes=None):

    if (self.remaining <= 0):
        raise InputStreamExhausted()
    if (num_bytes is None):
        num_bytes = self.remaining
    else:
        num_bytes = min(num_bytes, self.remaining)
    self.remaining -= num_bytes
    return self._file.read(num_bytes)
