code: def test_client_server_running_different_protocols(stage_protocol):
      def patched_index_syft_by_module_name(fully_qualified_name: str):
          if klass_v1.__name__ in fully_qualified_name:
              return klass_v1
          elif klass_v2.__name__ in fully_qualified_name:
              return klass_v2
  
          return index_syft_by_module_name(fully_qualified_name)
  
      node_name = UID().to_string()
      with mock.patch("syft.serde.recursive.TYPE_BANK", MOCK_TYPE_BANK):
          with mock.patch(
              "syft.protocol.data_protocol.TYPE_BANK",
              MOCK_TYPE_BANK,
          ):
              with mock.patch(
                  "syft.client.api.index_syft_by_module_name",
                  patched_index_syft_by_module_name,
              ):
                  # Setup mock object version one
                  nh1, klass_v1 = setup_version_one(node_name)
                  assert (
                      klass_v1.__canonical_name__
                      == "SyftMockObjectTest"
                  )
                  assert klass_v1.__name__ == "SyftMockObjectTestV1"
  
                  nh1_client = nh1.client
                  assert nh1_client is not None
                  result_from_client_1 = (
                      nh1_client.api.services.dummy.get()
                  )
  
                  protocol_version_with_mock_obj_v1 = (
                      get_data_protocol().latest_version
                  )
  
                  # No data saved
                  assert len(result_from_client_1) == 0
  
                  # Setup mock object version second
                  nh2, klass_v2 = setup_version_second(
                      node_name, klass_version_one=klass_v1
                  )
  
                  # Create a sample data in version second
                  sample_data = klass_v2(
                      full_name="John", version=str(1), id=UID()
                  )
  
                  assert isinstance(sample_data, klass_v2)
  
                  # Validate migrations
                  sample_data_v1 = sample_data.migrate_to(
                      version=klass_v1.__version__,
                  )
                  assert sample_data_v1.name == sample_data.full_name
                  assert sample_data_v1.version == int(
                      sample_data.version
                  )
  
                  # Set the sample data in version second
                  service_klass = nh1.python_node.get_service(
                      "SyftMockObjectService"
                  )
                  service_klass.stash.set(
                      nh1.python_node.root_client.verify_key,
                      sample_data,
                  )
  
                  nh2_client = nh2.client
                  assert nh2_client is not None
                  # Force communication protocol to when version object is defined
                  nh2_client.communication_protocol = (
                      protocol_version_with_mock_obj_v1
                  )
                  # Reset api
                  nh2_client._api = None
  
                  # Call the API with an older communication protocol version
                  result2 = nh2_client.api.services.dummy.get()
                  assert isinstance(result2, list)
  
                  # Validate the data received
                  for data in result2:
                      assert isinstance(data, klass_v1)
                      assert data.name == sample_data.full_name
                      assert data.version == int(sample_data.version)
      ServiceConfigRegistry.__service_config_registry__.pop(
          "dummy.syft_object", None
      )
  
imports: from copy import deepcopy
  from typing import List
  from typing import Type
  from typing import Union
  from unittest import mock
  import syft
  from syft.node.worker import Worker
  from syft.protocol.data_protocol import get_data_protocol
  from syft.serde.recursive import TYPE_BANK
  from syft.serde.serializable import serializable
  from syft.service.context import AuthedServiceContext
  from syft.service.response import SyftError
  from syft.service.service import AbstractService
  from syft.service.service import ServiceConfigRegistry
  from syft.service.service import service_method
  from syft.service.user.user_roles import GUEST_ROLE_LEVEL
  from syft.store.document_store import BaseStash
  from syft.store.document_store import DocumentStore
  from syft.store.document_store import PartitionSettings
  from syft.types.syft_migration import migrate
  from syft.types.syft_object import SYFT_OBJECT_VERSION_1
  from syft.types.syft_object import SYFT_OBJECT_VERSION_2
  from syft.types.syft_object import SyftBaseObject
  from syft.types.syft_object import SyftObject
  from syft.types.transforms import convert_types
  from syft.types.transforms import rename
  from syft.types.uid import UID
  from syft.util.util import index_syft_by_module_name
label_desc: Use image node_id 8 for calling a global function with example usage: test_client_server_running_different_protocols(stage_protocol) and returns: index_syft_by_module_name, klass_v1, klass_v2