code: def _get_folder_size(path: str) -> int:
      """Collect the size of each files within a folder.
  
      This method is robust to file deletion races
  
      """
      size = 0
      for dirpath, _, filenames in os.walk(str(path)):
          for filename in filenames:
              with contextlib.suppress(FileNotFoundError):
                  size += os.stat(
                      os.path.join(dirpath, filename)
                  ).st_size
      return size
  
imports: import contextlib
  import multiprocessing
  import os
  import warnings
  from logging import Logger
  from queue import Empty
  from threading import Thread
  from typing import Any, Dict, List, Optional, Tuple, Union
  from lightning.data.streaming.config import ChunksConfig
  from lightning.data.streaming.constants import _TORCH_GREATER_EQUAL_2_1_0
  from lightning.data.streaming.item_loader import BaseItemLoader, PyTreeLoader
  from lightning.data.streaming.sampler import ChunkedIndex
  from lightning.data.streaming.serializers import Serializer, _get_serializers
  from lightning.data.utilities.env import _DistributedEnv, _WorkerEnv
label_desc: Use image node_id 1 for calling a global function with example usage: _get_folder_size(path) and returns: size