def write(self, image, options, thumbnail):
args = settings.THUMBNAIL_VIPSTHUMBNAIL.split('<STR_LIT:U+0020>')<EOL>args.append(image['<STR_LIT:source>'])<EOL>for k in image['<STR_LIT>']:<EOL><INDENT>v = image['<STR_LIT>'][k]<EOL>args.append('<STR_LIT>' % k)<EOL>if v is not None:<EOL><INDENT>args.append('<STR_LIT:%s>' % v)<EOL><DEDENT><DEDENT>suffix = '<STR_LIT>' % EXTENSIONS[options['<STR_LIT>']]<EOL>write_options = []<EOL>if options['<STR_LIT>'] == '<STR_LIT>' and options.get(<EOL>'<STR_LIT>', settings.THUMBNAIL_PROGRESSIVE):<EOL><INDENT>write_options.append("<STR_LIT>")<EOL><DEDENT>if options['<STR_LIT>']:<EOL><INDENT>if options['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>write_options.append("<STR_LIT>" % options['<STR_LIT>'])<EOL><DEDENT><DEDENT>with NamedTemporaryFile(suffix=suffix, mode='<STR_LIT:rb>') as fp:<EOL><INDENT>args.append("<STR_LIT>")<EOL>args.append(fp.name + "<STR_LIT>" % "<STR_LIT:U+002C>".join(write_options))<EOL>args = map(smart_str, args)<EOL>p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)<EOL>p.wait()<EOL>out, err = p.communicate()<EOL>if err:<EOL><INDENT>raise Exception(err)<EOL><DEDENT>thumbnail.write(fp.read())<EOL><DEDENT>
Writes the thumbnail image