code: def remove_parent_folder_if_allowed(path: Path) -> None:
      deletion_disabled = os.getenv(
          NEPTUNE_DISABLE_PARENT_DIR_DELETION, "false"
      ).lower() in ("true", "1", "t")
  
      if not deletion_disabled:
          parent = path.parent
  
          try:
              files = os.listdir(parent)
          except FileNotFoundError:
              files = []
  
          if len(files) == 0:
              try:
                  os.rmdir(parent)
              except OSError:
                  logger.debug(f"Cannot remove directory: {parent}")
  
imports: import os
  from pathlib import Path
  from neptune.envs import NEPTUNE_DISABLE_PARENT_DIR_DELETION
  from neptune.internal.utils.logger import logger
label_desc: Use image node_id 1 for calling a global function with example usage: remove_parent_folder_if_allowed(path) without return types