code: def test_load_index(pool_params, distance):
      pool = Pool.from_file(
          pool_params["pool_file"], pool_params["component_type"], 10
      )
      hnsw_1 = Hnsw()
      hnsw_1.build(
          pool,
          distance,
          max_neighbors=5,
          search_neighborhood_size=30,
          batch_size=10,
          num_exact_candidates=10,
          num_threads=1,
      )
      index_path = yatest.common.test_output_path("index")
      hnsw_1.save(index_path)
      index_data = open(index_path, "rb").read()
      neighbors_before_save = hnsw_1.get_nearest(
          pool.get_item(0), 20, 40
      )
      hnsw_2 = Hnsw()
      hnsw_2.load_from_bytes(index_data, pool, distance)
      neighbors_after_load = hnsw_2.get_nearest(
          pool.get_item(0), 20, 40
      )
      assert neighbors_before_save == neighbors_after_load
  
imports: from __future__ import print_function
  import pytest
  import os
  import numpy
  import yatest.common
  import struct
  from hnsw import EVectorComponentType, EDistance, Pool, Hnsw, HnswException, transform_mobius, HnswEstimator, OnlineHnsw
label_desc: Use image node_id 9 for calling a global function with example usage: test_load_index(pool_params, distance) without return types