code: def _multiply_uint8_optimized(img, multiplier):
      if is_grayscale_image(img) or len(multiplier) == 1:
          multiplier = multiplier[0]
          lut = np.arange(0, 256, dtype=np.float32)
          lut *= multiplier
          lut = clip(lut, np.uint8, MAX_VALUES_BY_DTYPE[img.dtype])
          func = _maybe_process_in_chunks(cv2.LUT, lut=lut)
          return func(img)
  
      channels = img.shape[-1]
      lut = [np.arange(0, 256, dtype=np.float32)] * channels
      lut = np.stack(lut, axis=-1)
  
      lut *= multiplier
      lut = clip(lut, np.uint8, MAX_VALUES_BY_DTYPE[img.dtype])
  
      images = []
      for i in range(channels):
          func = _maybe_process_in_chunks(cv2.LUT, lut=lut[:, i])
          images.append(func(img[:, :, i]))
      return np.stack(images, axis=-1)
  
imports: from __future__ import division
  from typing import Optional, Sequence, Union
  from warnings import warn
  import cv2
  import numpy
  import skimage
  from albumentations import random_utils
  from albumentations.augmentations.utils import MAX_VALUES_BY_DTYPE, _maybe_process_in_chunks, clip, clipped, ensure_contiguous, is_grayscale_image, is_rgb_image, non_rgb_warning, preserve_channel_dim, preserve_shape
label_desc: Use image node_id 43 for calling a global function with example usage: _multiply_uint8_optimized(img, multiplier) and returns: np, func