code: def posterize(image, bits):
      """
      Reduce the number of bits for each color channel.
  
      :param image: The image to posterize.
      :param bits: The number of bits to keep for each channel (1-8).
      :return: An image.
      """
      mask = ~(2 ** (8 - bits) - 1)
      lut = [i & mask for i in range(256)]
      return _lut(image, lut)
  
imports: from __future__ import annotations
  import functools
  import operator
  import re
  from .None import ExifTags, Image, ImagePalette
label_desc: Use image node_id 19 for calling a global function with example usage: posterize(image, bits) and returns: _lut