def fetchmany(self, size=None):
        # PEP 249
        self._wait_to_finish()
        if not self.has_result_set:
            raise ProgrammingError("Tried to fetch but no results.")
        if size is None:
            size = self.arraysize
        log.debug('Fetching up to %s result rows', size)
        local_buffer = []
        i = 0
        while i < size:
            try:
                local_buffer.append(next(self))
                i += 1
            except __HOLE__:
                break
        return local_buffer
dataset/ETHPy150Open cloudera/impyla/impala/hiveserver2.py/HiveServer2Cursor.fetchmany