def _fetch_chunker(self, uri, chunk_size, size, obj_size):
        """
        Returns a generator that returns an object in chunks.
        """
        pos = 0
        total_bytes = 0
        size = size or obj_size
        max_size = min(size, obj_size)
        while True:
            endpos = min(obj_size, pos + chunk_size - 1)
            headers = {"Range": "bytes=%s-%s" % (pos, endpos)}
            resp, resp_body = self.api.method_get(uri, headers=headers,
                    raw_content=True)
            pos = endpos + 1
            if not resp_body:
                # End of file
                raise StopIteration
            yield resp_body
            total_bytes += len(resp_body)
            if total_bytes >= max_size:
                raise StopIteration
dataset/ETHPy150Open rackspace/pyrax/pyrax/object_storage.py/StorageObjectManager._fetch_chunker/original