code: def scan_data(self):
      # TODO(jhr): handle some assertions as file corruption issues
      # how much left in the block.  if less than header len, read as pad,
      offset = self._index % LEVELDBLOG_BLOCK_LEN
      space_left = LEVELDBLOG_BLOCK_LEN - offset
      if space_left < LEVELDBLOG_HEADER_LEN:
          pad_check = strtobytes("\x00" * space_left)
          pad = self._fp.read(space_left)
          # verify they are zero
          assert pad == pad_check, "invalid padding"
          self._index += space_left
  
      record = self.scan_record()
      if record is None:  # eof
          return None
      dtype, data = record
      if dtype == LEVELDBLOG_FULL:
          return data
  
      assert (
          dtype == LEVELDBLOG_FIRST
      ), f"expected record to be type {LEVELDBLOG_FIRST} but found {dtype}"
      while True:
          offset = self._index % LEVELDBLOG_BLOCK_LEN
          record = self.scan_record()
          if record is None:  # eof
              return None
          dtype, new_data = record
          if dtype == LEVELDBLOG_LAST:
              data += new_data
              break
          assert (
              dtype == LEVELDBLOG_MIDDLE
          ), f"expected record to be type {LEVELDBLOG_MIDDLE} but found {dtype}"
          data += new_data
      return data
  
imports: import logging
  import os
  import struct
  import zlib
  from typing import TYPE_CHECKING, Optional, Tuple
  import wandb
label_desc: Use image node_id 9 for calling the DataStore obj's underlying member method code with example usage: obj.scan_data() and returns: data, None, data, None