class_docstr: Writes given dataset into FFCV format (.beton).
  Supports indexable objects (e.g., PyTorch Datasets) and webdataset.
  
  Parameters
  ----------
  fname: str
      File name to store dataset in FFCV format (.beton)
  fields : Mapping[str, Field]
      Map from keys to Field's (order matters!)
  page_size : int
      Page size used internally
  num_workers : int
      Number of processes to use
code: def __init__(
      self,
      fname: str,
      fields: Mapping[str, Field],
      page_size: int = 4 * MIN_PAGE_SIZE,
      num_workers: int = -1,
  ):
      self.fields = fields
      self.fname = fname
      self.metadata_type = get_metadata_type(list(self.fields.values()))
  
      self.num_workers = num_workers
      # We use all cores by default
      if self.num_workers < 1:
          self.num_workers = cpu_count()
  
      if not is_power_of_2(page_size):
          raise ValueError(f"page_size isnt a power of 2")
      if page_size < MIN_PAGE_SIZE:
          raise ValueError(
              f"page_size can't be lower than{MIN_PAGE_SIZE}"
          )
      if page_size >= MAX_PAGE_SIZE:
          raise ValueError(
              f"page_size can't be bigger(or =) than{MAX_PAGE_SIZE}"
          )
  
      self.page_size = page_size
  
imports: from functools import partial
  from typing import Callable, List, Mapping
  from os import SEEK_END, path
  import numpy
  from time import sleep
  import ctypes
  from multiprocessing import shared_memory, cpu_count, Queue, Process, Value
  from tqdm import tqdm
  from tqdm.contrib.concurrent import thread_map
  from .utils import chunks, is_power_of_2
  from .fields.base import Field
  from .memory_allocator import MemoryAllocator
  from .types import TYPE_ID_HANDLER, get_metadata_type, HeaderType, FieldDescType, CURRENT_VERSION, ALLOC_TABLE_TYPE
label_desc: Use image node_id 1 to create a new DatasetWriter object  with example: obj = DatasetWriter(fname, fields, page_size, num_workers)