def gunzip(data):
    f = GzipFile(fileobj=BytesIO(data))
    output = b''
    chunk = b'.'
    while chunk:
        try:
            chunk = read1(f, 8196)
            output += chunk
        except (IOError, EOFError, struct.error):
            # complete only if there is some data, otherwise re-raise
            # see issue 87 about catching struct.error
            # some pages are quite small so output is '' and f.extrabuf
            # contains the whole page content
            if output or getattr(f, 'extrabuf', None):
                try:
                    output += f.extrabuf
                finally:
                    break
            else:
                raise
    return output
Changes an attribute of an image.
dataset/ETHPy150Open scrapy/scrapy/scrapy/utils/gz.py/gunzip--crossover with--dataset/ETHPy150Open darcyliu/storyboard/boto/ec2/connection.py/EC2Connection.modify_image_attribute