code: def _make_dir_and_save_image(
      output_dir: str, filename: str, img: Image
  ):
      """Saves the images and creates necessary subdirectories."""
      path = os.path.join(output_dir, filename)
  
      head = os.path.split(path)[0]
      if not os.path.exists(head):
          os.makedirs(head)
  
      img.save(path)
      img.close()
  
imports: import io
  import os
  import urllib.request
  import warnings
  from concurrent.futures.thread import ThreadPoolExecutor
  from typing import Dict, List, Optional
  from urllib.request import Request
  import tqdm
  from PIL import Image
  from lightly.api import download, utils
  from lightly.api.bitmask import BitMask
  from lightly.openapi_generated.swagger_client.models import DatasetEmbeddingData, ImageType
  from lightly.utils.hipify import bcolors
label_desc: Use image node_id 1 for calling a global function with example usage: _make_dir_and_save_image(output_dir, filename, img) without return types