code: def _test_save_load_object_helper(testcase, obj, path):
      """
      Helper function to test save and load a server side object to a given url.
      """
  
      def cleanup(url):
          """
          Remove the saved file from temp directory.
          """
          tempdir = tempfile.gettempdir()
          pattern = path + "*"
          for f in os.listdir(tempdir):
              if fnmatch.fnmatch(pattern, f):
                  os.remove(os.path.join(tempdir, f))
  
      def assert_same_elements(x, y):
          if sys.version_info.major >= 3:
              testcase.assertCountEqual(x, y)
          else:
              testcase.assertItemsEqual(x, y)
  
      if isinstance(obj, SGraph):
          obj.save(path + ".graph")
          newobj = load_sgraph(path + ".graph")
          assert_same_elements(obj.get_fields(), newobj.get_fields())
          testcase.assertDictEqual(obj.summary(), newobj.summary())
      elif isinstance(obj, Model):
          obj.save(path + ".model")
          newobj = load_model(path + ".model")
          assert_same_elements(
              obj._list_fields(), newobj._list_fields()
          )
          testcase.assertEqual(type(obj), type(newobj))
      elif isinstance(obj, SFrame):
          obj.save(path + ".frame_idx")
          newobj = load_sframe(path + ".frame_idx")
          testcase.assertEqual(obj.shape, newobj.shape)
          testcase.assertEqual(
              obj.column_names(), newobj.column_names()
          )
          testcase.assertEqual(
              obj.column_types(), newobj.column_types()
          )
          assert_frame_equal(
              obj.head(obj.num_rows()).to_dataframe(),
              newobj.head(newobj.num_rows()).to_dataframe(),
          )
      else:
          raise TypeError
      cleanup(path)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import sys
  import json
  import logging
  import os
  import fnmatch
  import tempfile
  import unittest
  import pandas
  from .._connect import main
  from ..None import _sys_util
  from ..None import util
  from ..None import SGraph, SFrame, load_sgraph, load_model, load_sframe
  from turicreate.toolkits._model import Model
  from pandas.util.testing import assert_frame_equal
label_desc: Use image node_id 1 for calling a global function with example usage: _test_save_load_object_helper(testcase, obj, path) without return types