parameters: (image, format, **params)
return_statement: return stream.getvalue()
docstring: Return the given PIL `image` using `params`.
  
      :param image: the PIL image
      :type image: PIL.Image
  
      :param params: params to expand when calling PIL.Image.save()
      :type params: dict
  
      :return: the image formatted
      :rtype: bytes
docstring_summary: Return the given PIL `image` using `params`.
docstring_tokens: Return the given PIL image using params .
function: def image_apply_opt(image, format, **params):
      """Return the given PIL `image` using `params`.
  
      :param image: the PIL image
      :type image: PIL.Image
  
      :param params: params to expand when calling PIL.Image.save()
      :type params: dict
  
      :return: the image formatted
      :rtype: bytes
      """
      stream = io.BytesIO()
      image.save(stream, format=format, **params)
      return stream.getvalue()
function_tokens: def image_apply_opt ( image , format , * * params ) : stream = io . BytesIO ( ) image . save ( stream , format = format , * * params ) return stream . getvalue ( )