def format_image(self, image, image_format, **kwargs):
image_format = image_format.lower()<EOL>accept = self.request.META['<STR_LIT>'].split('<STR_LIT:U+002C>')<EOL>if FORCE_WEBP and '<STR_LIT>' in accept:<EOL><INDENT>image_format = '<STR_LIT>'<EOL><DEDENT>elif image_format == '<STR_LIT>':<EOL><INDENT>alpha = image.split()[-<NUM_LIT:1>]<EOL>image = image.convert('<STR_LIT>')<EOL>image = image.convert('<STR_LIT:P>', palette=Image.ADAPTIVE, colors=<NUM_LIT:255>)<EOL>image.paste(<NUM_LIT:255>, Image.eval(alpha, lambda x: <NUM_LIT:255> if x <= <NUM_LIT> else <NUM_LIT:0>))<EOL>image_format = '<STR_LIT>'<EOL>kwargs['<STR_LIT>'] = <NUM_LIT:255><EOL><DEDENT>elif image_format in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>image_format = '<STR_LIT>'<EOL><DEDENT>return super(GetImageView, self).format_image(image, image_format, **kwargs)<EOL>
Returns an image in the request format