code: def test_palette_save_P(tmp_path):
      # Pass in a different palette, then construct what the image would look like.
      # Forcing a non-straight grayscale palette.
  
      im = hopper("P")
      palette = bytes(255 - i // 3 for i in range(768))
  
      out = str(tmp_path / "temp.gif")
      im.save(out, palette=palette)
  
      with Image.open(out) as reloaded:
          im.putpalette(palette)
          assert_image_equal(reloaded, im)
  
imports: from io import BytesIO
  import pytest
  from PIL import GifImagePlugin, Image, ImageDraw, ImagePalette, features
  from .helper import assert_image_equal, assert_image_equal_tofile, assert_image_similar, hopper, is_pypy, netpbm_available
label_desc: Use image node_id 53 for calling a global function with example usage: test_palette_save_P(tmp_path) without return types