docstr: Search for the metadata for an object.
docstr_tok: ["Search","for","the","metadata","for","an","object","."]
code: def get_version(
      self, context: AuthedServiceContext, canonical_name: str
  ) -> Union[int, SyftError]:
      """Search for the metadata for an object."""
  
      result = self.stash.get_by_name(
          canonical_name=canonical_name, credentials=context.credentials
      )
  
      if result.is_err():
          return SyftError(message=f"{result.err()}")
  
      migration_state = result.ok()
  
      if migration_state is None:
          return SyftError(
              message=f"No migration state exists for canonical name: {canonical_name}"
          )
  
      return migration_state.current_version
  
file_path: PySyft/packages/syft/src/syft/service/object_search/migration_state_service.py
imports: from typing import Union
  from ...serde.serializable import serializable
  from ...store.document_store import DocumentStore
  from ..context import AuthedServiceContext
  from ..response import SyftError
  from ..service import AbstractService
  from ..service import service_method
  from .object_migration_state import SyftMigrationStateStash
  from .object_migration_state import SyftObjectMigrationState
label_desc: Use image node_id 2 for calling the MigrateStateService obj's underlying member method code with example usage: obj.get_version(context, canonical_name) and returns: migration_state, SyftError, SyftError