docstr: Modifies the pixel at x,y. The color is given as a single
  numerical value for single band images, and a tuple for
  multi-band images
  
  :param xy: The pixel coordinate, given as (x, y). See
     :ref:`coordinate-system`.
  :param color: The pixel value.
docstr_tok: ["Modifies","the","pixel","at","x",",","y",".","The","color","is","given","as","a","single","numerical","value","for","single","band","images",",","and","a","tuple","for","multi-band","images",":","param","xy",":","The","pixel","coordinate",",","given","as","(","x",",","y",")",".","See",":","ref",":","`","coordinate-system","`",".",":","param","color",":","The","pixel","value","."]
code: def __setitem__(self, xy, color):
      """
      Modifies the pixel at x,y. The color is given as a single
      numerical value for single band images, and a tuple for
      multi-band images
  
      :param xy: The pixel coordinate, given as (x, y). See
         :ref:`coordinate-system`.
      :param color: The pixel value.
      """
      if self.readonly:
          raise ValueError("Attempt to putpixel a read only image")
      (x, y) = xy
      if x < 0:
          x = self.xsize + x
      if y < 0:
          y = self.ysize + y
      (x, y) = self.check_xy((x, y))
  
      if (
          self._im.mode == "P"
          and isinstance(color, (list, tuple))
          and len(color) in [3, 4]
      ):
          # RGB or RGBA value for a P image
          color = self._palette.getcolor(color, self._img)
  
      return self.set_pixel(x, y, color)
  
imports: import logging
  import sys
label_desc: Use image node_id 3 for calling the PyAccess obj's underlying member method code with example usage: obj.__setitem__(xy, color) and returns: self