code: def load(filename):
      # FIXME: supports GIMP gradients only
  
      with open(filename, "rb") as fp:
          for paletteHandler in [
              GimpPaletteFile.GimpPaletteFile,
              GimpGradientFile.GimpGradientFile,
              PaletteFile.PaletteFile,
          ]:
              try:
                  fp.seek(0)
                  lut = paletteHandler(fp).getpalette()
                  if lut:
                      break
              except (SyntaxError, ValueError):
                  # import traceback
                  # traceback.print_exc()
                  pass
          else:
              raise OSError("cannot load palette")
  
      return lut
  
file_path: pillow-simd/src/PIL/ImagePalette.py
imports: import array
  import warnings
  from .None import GimpGradientFile, GimpPaletteFile, ImageColor, PaletteFile
label_desc: Use image node_id 8 for calling a global function with example usage: load(filename) and returns: lut