<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def consume_messages(self, batchsize):
 """ Get messages batch from the reservoir """

        if not self._reservoir:
            self.finished = True
            return
        for msg in self._reservoir[:batchsize]:
            yield msg
        self._reservoir = self._reservoir[batchsize:]