class_docstr: Experiment writer for CSVLogger.
  
  Args:
      log_dir: Directory for the experiment logs
code: def __init__(self, log_dir: str) -> None:
      self.metrics: List[Dict[str, float]] = []
      self.metrics_keys: List[str] = []
  
      self._fs = get_filesystem(log_dir)
      self.log_dir = log_dir
      if self._fs.exists(self.log_dir) and self._fs.listdir(
          self.log_dir
      ):
          rank_zero_warn(
              f"Experiment logs directory {self.log_dir} exists and is not empty."
              " Previous log files in this directory will be deleted when the new ones are saved!"
          )
      self._fs.makedirs(self.log_dir, exist_ok=True)
  
      self.metrics_file_path = os.path.join(
          self.log_dir, self.NAME_METRICS_FILE
      )
  
imports: import csv
  import logging
  import os
  from argparse import Namespace
  from typing import Any, Dict, List, Optional, Set, Union
  from torch import Tensor
  from typing_extensions import override
  from lightning.fabric.loggers.logger import Logger, rank_zero_experiment
  from lightning.fabric.utilities.cloud_io import _is_dir, get_filesystem
  from lightning.fabric.utilities.logger import _add_prefix
  from lightning.fabric.utilities.rank_zero import rank_zero_only, rank_zero_warn
  from lightning.fabric.utilities.types import _PATH
label_desc: Use image node_id 1 to create a new _ExperimentWriter object  with example: obj = _ExperimentWriter(log_dir)