docstr: Write record that must fit into a block.
docstr_tok: ["Write","record","that","must","fit","into","a","block","."]
code: def _write_record(self, s, dtype=None):
      """Write record that must fit into a block."""
      # double check that there is enough space
      # (this is a precondition to calling this method)
      assert len(s) + LEVELDBLOG_HEADER_LEN <= (
          LEVELDBLOG_BLOCK_LEN - self._index % LEVELDBLOG_BLOCK_LEN
      ), "not enough space to write new records"
  
      dlength = len(s)
      dtype = dtype or LEVELDBLOG_FULL
      # print("record: length={} type={}".format(dlength, dtype))
      checksum = zlib.crc32(s, self._crc[dtype]) & 0xFFFFFFFF
      # logger.info("write_record: index=%d len=%d dtype=%d",
      #     self._index, dlength, dtype)
      self._fp.write(struct.pack("<IHB", checksum, dlength, dtype))
      if dlength:
          self._fp.write(s)
      self._index += LEVELDBLOG_HEADER_LEN + len(s)
  
imports: import logging
  import os
  import struct
  import zlib
  from typing import TYPE_CHECKING, Optional, Tuple
  import wandb
label_desc: Use image node_id 12 for calling the DataStore obj's underlying member method code with example usage: obj._write_record(s, dtype) without return types