code: def _check_mean_sub_values(value, channels):
      """
          Checks if mean subtraction values are valid based on the number of channels
          "value" must be a tuple of dimensions = number of channels
      Returns boolean:
          True -> Expression is valid
          False -> Expression is invalid
      """
      if value is None:
          raise ValueError("Value(s) specified is of NoneType()")
  
      if isinstance(value, tuple):
          # If not a tuple, we convert it to one
          try:
              value = tuple(value)
          except TypeError:
              value = tuple([value])
  
      if channels not in [1, 3]:
          raise ValueError(
              "Number of channels must be either 1 (Grayscale) or 3 (RGB/BGR)"
          )
  
      if len(value) not in [1, 3]:
          raise ValueError(
              "Tuple length must be either 1 (subtraction over the entire image) or 3 (per channel subtraction)"
              f"Got {value}"
          )
  
      if len(value) == channels:
          return True
  
      else:
          raise ValueError(
              f"Expected a tuple of dimension {channels}. Got {value}"
          )
  
file_path: caer/caer/_internal.py
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _check_mean_sub_values(value, channels) and returns: True