code: def _save(im, fp, filename):
      lossless = im.encoderinfo.get("lossless", False)
      quality = im.encoderinfo.get("quality", 80)
      icc_profile = im.encoderinfo.get("icc_profile", "")
      exif = im.encoderinfo.get("exif", "")
      if isinstance(exif, Image.Exif):
          exif = exif.tobytes()
      xmp = im.encoderinfo.get("xmp", "")
  
      if im.mode not in _VALID_WEBP_LEGACY_MODES:
          alpha = (
              "A" in im.mode
              or "a" in im.mode
              or (im.mode == "P" and "A" in im.im.getpalettemode())
          )
          im = im.convert("RGBA" if alpha else "RGB")
  
      data = _webp.WebPEncode(
          im.tobytes(),
          im.size[0],
          im.size[1],
          lossless,
          float(quality),
          im.mode,
          icc_profile,
          exif,
          xmp,
      )
      if data is None:
          raise IOError(
              "cannot write file as WebP (encoder returned None)"
          )
  
      fp.write(data)
  
file_path: catboost/contrib/python/Pillow/py2/PIL/WebPImagePlugin.py
imports: from io import BytesIO
  from .None import Image, ImageFile
label_desc: Use image node_id 3 for calling a global function with example usage: _save(im, fp, filename) without return types