code: def img_shape_checker(method):
      """Decorator to ensure that the image has always 3 dimensions: WxHC
  
      Parameters
      ----------
      method : _apply_img method of BaseTransform
  
      Returns
      -------
      out : method of a class
          Result
  
      """
  
      @wraps(method)
      def wrapper(self, *args, **kwargs):
          res = method(self, *args, **kwargs)
          if len(res.shape) == 2:
              h, w = res.shape
              return res.reshape((h, w, 1))
          elif len(res.shape) != 3:
              raise ValueError
  
          return res
  
      return wrapper
  
file_path: solt/solt/utils/_utils.py
imports: from functools import wraps
  import json
  import yaml
  import inspect
label_desc: Use image node_id 4 for calling a global function with example usage: img_shape_checker(method) and returns: wrapper, res, res