<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_image(self, image):
 """Set display buffer to Python Image Library image. Image will be converted to 1 bit color and non-zero color values will light the LEDs. """

        imwidth, imheight = image.size
        if imwidth != 8 or imheight != 16:
            raise ValueError('Image must be an 8x16 pixels in size.')
        # Convert image to 1 bit color and grab all the pixels.
        pix = image.convert('1').load()
        # Loop through each pixel and write the display buffer pixel.
        for x in xrange(8):
            for y in xrange(16):
                color = pix[(x, y)]
                # Handle the color of the pixel, off or on.
                if color == 0:
                    self.set_pixel(x, y, 0)
                else:
                    self.set_pixel(x, y, 1)