def save_image(self, name):
        """Save the image to a file. Keep trying by re-glitching the image with
        less iterations if it fails
        """

        while True:
            try:
                stream = io.BytesIO(self.new_bytes)
                im = Image.open(stream)
                im.save(name)
                return
            except __HOLE__:
                if self.parameters['iterations'] == 1:
                    raise click.BadParameter(message='This image is beyond\
                            repair, maybe try again?', param_hint=['image'])

                self.parameters['iterations'] -= 1
                self.glitch_bytes()
dataset/ETHPy150Open Kareeeeem/jpglitch/jpglitch.py/Jpeg.save_image