code: def test_palette_handling(tmp_path):
      # see https://github.com/python-pillow/Pillow/issues/513
  
      with Image.open(TEST_GIF) as im:
          im = im.convert("RGB")
  
          im = im.resize((100, 100), Image.LANCZOS)
          im2 = im.convert("P", palette=Image.ADAPTIVE, colors=256)
  
          f = str(tmp_path / "temp.gif")
          im2.save(f, optimize=True)
  
      with Image.open(f) as reloaded:
          assert_image_similar(im, reloaded.convert("RGB"), 10)
  
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 14 for calling a global function with example usage: test_palette_handling(tmp_path) without return types