class_docstr: Maps 3D data arrays of shape ``(ny, nx, nstack)`` to 2D RGBA images
  of shape ``(ny, nx)`` using a palette of length ``nstack``.
  
  The mapping occurs in two stages. Firstly the RGB values are calculated
  using a weighted sum of the palette colors in the ``nstack`` direction.
  Then the alpha values are calculated using the ``alpha_mapper`` applied to
  the sum of the array in the ``nstack`` direction.
  
  The RGB values calculated by the ``alpha_mapper`` are ignored by the color
  mapping but are used in any ``ColorBar`` that is displayed.
code: def _check_label_length(self):
      if self.stack_labels is not None:
          nlabel = len(self.stack_labels)
          npalette = len(self.palette)
          if nlabel > npalette:
              self.stack_labels = self.stack_labels[:npalette]
              return f"{nlabel} != {npalette}, removing unwanted stack_labels"
          elif nlabel < npalette:
              self.stack_labels = list(self.stack_labels) + [""] * (
                  npalette - nlabel
              )
              return (
                  f"{nlabel} != {npalette}, padding with empty strings"
              )
  
imports: from __future__ import annotations
  import logging
  from ..None import palettes
  from ..core.enums import Palette
  from ..core.has_props import abstract
  from ..core.properties import Bool, Color, Either, Enum, FactorSeq, Float, HatchPatternType, Instance, Int, List, MarkerType, Nullable, Seq, String, Tuple
  from ..core.validation import error, warning
  from ..core.validation.errors import WEIGHTED_STACK_COLOR_MAPPER_LABEL_LENGTH_MISMATCH
  from ..core.validation.warnings import PALETTE_LENGTH_FACTORS_MISMATCH
  from .transforms import Transform
label_desc: Use image node_id 2 for calling the WeightedStackColorMapper obj's underlying member method code with example usage: obj._check_label_length() and returns: nlabel, str, npalette, str, nlabel, str, npalette, str