code: def pil_loader(path, color_space=""):
      """
      Attempts to load a file using PIL with provided ``color_space``.
  
      :param path: (string): file to load
      :param color_space: (string, one of `{rgb, rgba, L, 1, binary}`): Specifies the colorspace
          to use for PIL loading. If not provided a simple ``Image.open(path)`` will be performed.
  
      :return: PIL image
      """
      try:
          if color_space.lower() == "rgb":
              return Image.open(path).convert("RGB")
          if color_space.lower() == "rgba":
              return Image.open(path).convert("RGBA")
          elif color_space.lower() == "l":
              return Image.open(path).convert("L")
          elif color_space.lower() in ("1", "binary"):
              return Image.open(path).convert("1")
          else:
              return Image.open(path)
      except OSError:
          raise Exception("!!!  Could not read path: " + path)
  
imports: import fnmatch
  import os
  import os.path
  import random
  import warnings
  import numpy
  import tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: pil_loader(path, color_space) and returns: Image, Image, Image, Image, Image