code: def __init__(self, filename: str, page_size: int):
      self.filename = filename + "-wal"
      self._fd, self._dir_fd = open_file_in_dir(self.filename)
      self._page_size = page_size
      self._committed_pages = dict()
      self._not_committed_pages = dict()
  
      self._fd.seek(0, io.SEEK_END)
      if self._fd.tell() == 0:
          self._create_header()
          self.needs_recovery = False
      else:
          logger.warning(
              "Found an existing WAL file, "
              "the B+Tree was not closed properly"
          )
          self.needs_recovery = True
          self._load_wal()
  
imports: import enum
  import io
  from logging import getLogger
  import os
  import platform
  from typing import Union, Tuple, Optional
  import cachetools
  import rwlock
  from .node import Node, FreelistNode
  from .const import ENDIAN, PAGE_REFERENCE_BYTES, OTHERS_BYTES, TreeConf, FRAME_TYPE_BYTES
label_desc: Use image node_id 1 to create a new WAL object  with example: obj = WAL(filename, page_size)