code: def pil_loader(key, data):
      r"""
      Function to load an image.
      If the image is corrupt, it returns a black image.
      Args:
          key: Image key.
          data: Image data stream.
      """
      extension = re.sub(r".*[.]", "", key)
      if extension.lower() not in _IMG_EXTENSIONS:
          return None
  
      with io.BytesIO(data) as stream:
          img = Image.open(stream)
          img.load()
          img = img.convert("RGB")
  
      return img
  
imports: import io
  import itertools
  import json
  import os
  import pickle
  import random
  import re
  from typing import Callable, List, Union
  import boto3
  import torch.distributed
  from botocore.config import Config
  from PIL import Image
  from nemo.collections.multimodal.data.common.data_samplers import SharedEpoch, WDSUrlsRandomSampler
  from nemo.collections.multimodal.data.common.webdataset_s3 import WebDataset
  from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults
  from nemo.core.classes import IterableDataset
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: pil_loader(key, data) and returns: img, None