code: def dump(self) -> bytearray:
      data = bytearray()
      for record in self.entries:
          data.extend(record.dump())
  
      # used_page_length = len(header) + len(data), but the header is
      # generated later
      used_page_length = len(data) + 4 + PAGE_REFERENCE_BYTES
      assert 0 < used_page_length <= self._tree_conf.page_size
      assert len(data) <= self.max_payload
  
      next_page = 0 if self.next_page is None else self.next_page
      header = (
          self._node_type_int.to_bytes(1, ENDIAN)
          + used_page_length.to_bytes(3, ENDIAN)
          + next_page.to_bytes(PAGE_REFERENCE_BYTES, ENDIAN)
      )
  
      data = bytearray(header) + data
  
      padding = self._tree_conf.page_size - used_page_length
      assert padding >= 0
      data.extend(bytearray(padding))
      assert len(data) == self._tree_conf.page_size
  
      return data
  
imports: import abc
  import bisect
  import math
  from typing import Optional
  from .const import ENDIAN, NODE_TYPE_BYTES, USED_PAGE_LENGTH_BYTES, PAGE_REFERENCE_BYTES, TreeConf
  from .entry import Entry, Record, Reference, OpaqueData
label_desc: Use image node_id 3 for calling the Node obj's underlying member method code with example usage: obj.dump() and returns: data