code: def __init__(self, fp):
      self.palette = [o8(i) * 3 for i in range(256)]
  
      if fp.readline()[:12] != b"GIMP Palette":
          raise SyntaxError("not a GIMP palette file")
  
      for i in range(256):
          s = fp.readline()
          if not s:
              break
  
          # skip fields and comment lines
          if re.match(rb"\w+:|#", s):
              continue
          if len(s) > 100:
              raise SyntaxError("bad palette file")
  
          v = tuple(map(int, s.split()[:3]))
          if len(v) != 3:
              raise ValueError("bad palette entry")
  
          self.palette[i] = o8(v[0]) + o8(v[1]) + o8(v[2])
  
      self.palette = b"".join(self.palette)
  
imports: import re
  from ._binary import o8
label_desc: Use image node_id 1 to create a new GimpPaletteFile object from inherited base classes: object with example: obj = GimpPaletteFile(fp)