code: def detect_color_mode(train_directory, target_size=(32, 32)):
      try:
          fname = glob.glob(os.path.join(train_directory, "**/*"))[0]
          img = Image.open(fname).resize(target_size)
          num_channels = len(img.getbands())
          if num_channels == 3:
              return "rgb"
          elif num_channels == 1:
              return "grayscale"
          else:
              return "rgby"
      except:
          warnings.warn(
              "could not detect color_mode from %s" % (train_directory)
          )
          return
  
imports: from ..None import utils
  from ..imports import *
  from .preprocessor import ImagePreprocessor
label_desc: Use image node_id 11 for calling a global function with example usage: detect_color_mode(train_directory, target_size) and returns: str, str, str