code: def decode(self, buffer: bytes) -> tuple[int, int]:
      assert self.fd is not None
  
      data = bytearray()
      maxval = self.args[-1]
      in_byte_count = 1 if maxval < 256 else 2
      out_byte_count = 4 if self.mode == "I" else 1
      out_max = 65535 if self.mode == "I" else 255
      bands = Image.getmodebands(self.mode)
      while (
          len(data)
          < self.state.xsize * self.state.ysize * bands * out_byte_count
      ):
          pixels = self.fd.read(in_byte_count * bands)
          if len(pixels) < in_byte_count * bands:
              # eof
              break
          for b in range(bands):
              value = (
                  pixels[b]
                  if in_byte_count == 1
                  else i16(pixels, b * in_byte_count)
              )
              value = min(out_max, round(value / maxval * out_max))
              data += o32(value) if self.mode == "I" else o8(value)
      rawmode = "I;32" if self.mode == "I" else self.mode
      self.set_as_raw(bytes(data), rawmode)
      return -1, 0
  
imports: from __future__ import annotations
  import math
  from io import BytesIO
  from .None import Image, ImageFile
  from ._binary import i16be
  from ._binary import o8
  from ._binary import o32le
label_desc: Use image node_id 1 for calling the PpmDecoder obj's underlying member method code with example usage: obj.decode(buffer) and returns: unknown,  int