code: def subtest_io_and_clone(self, index, Dnsg, Insg):
      fd, tmpfile = tempfile.mkstemp()
      os.close(fd)
      try:
          faiss.write_index(index, tmpfile)
          index2 = faiss.read_index(tmpfile)
      finally:
          if os.path.exists(tmpfile):
              os.unlink(tmpfile)
  
      Dnsg2, Insg2 = index2.search(self.xq, 1)
      np.testing.assert_array_equal(Dnsg2, Dnsg)
      np.testing.assert_array_equal(Insg2, Insg)
  
      # also test clone
      index3 = faiss.clone_index(index)
      Dnsg3, Insg3 = index3.search(self.xq, 1)
      np.testing.assert_array_equal(Dnsg3, Dnsg)
      np.testing.assert_array_equal(Insg3, Insg)
  
imports: import numpy
  import unittest
  import faiss
  import tempfile
  import os
  from common_faiss_tests import get_dataset_2
label_desc: Use image node_id 3 for calling the TestNSG obj's underlying member method code with example usage: obj.subtest_io_and_clone(index, Dnsg, Insg) without return types