code: def rs_object2proto(
      self: Any, for_hashing: bool = False
  ) -> _DynamicStructBuilder:
      # relative
      from ..types.syft_object import DYNAMIC_SYFT_ATTRIBUTES
  
      is_type = False
      if isinstance(self, type):
          is_type = True
  
      msg = recursive_scheme.new_message()
      fqn = get_fully_qualified_name(self)
      if fqn not in TYPE_BANK:
          # third party
          raise Exception(f"{fqn} not in TYPE_BANK")
  
      msg.fullyQualifiedName = fqn
      (
          nonrecursive,
          serialize,
          deserialize,
          attribute_list,
          exclude_attrs_list,
          serde_overrides,
          hash_exclude_attrs,
          cls,
          attribute_types,
          version,
      ) = TYPE_BANK[fqn]
  
      if nonrecursive or is_type:
          if serialize is None:
              raise Exception(
                  f"Cant serialize {type(self)} nonrecursive without serialize."
              )
          chunk_bytes(serialize(self), "nonrecursiveBlob", msg)
          return msg
  
      if attribute_list is None:
          attribute_list = self.__dict__.keys()
  
      hash_exclude_attrs_set = (
          set(hash_exclude_attrs).union(set(DYNAMIC_SYFT_ATTRIBUTES))
          if for_hashing
          else set()
      )
      attribute_list = (
          set(attribute_list)
          - set(exclude_attrs_list)
          - hash_exclude_attrs_set
      )
  
      msg.init("fieldsName", len(attribute_list))
      msg.init("fieldsData", len(attribute_list))
  
      for idx, attr_name in enumerate(sorted(attribute_list)):
          if not hasattr(self, attr_name):
              raise ValueError(
                  f"{attr_name} on {type(self)} does not exist, serialization aborted!"
              )
  
          field_obj = getattr(self, attr_name)
          transforms = serde_overrides.get(attr_name, None)
  
          if transforms is not None:
              field_obj = transforms[0](field_obj)
  
          if isinstance(field_obj, types.FunctionType):
              continue
  
          serialized = sy.serialize(
              field_obj, to_bytes=True, for_hashing=for_hashing
          )
          msg.fieldsName[idx] = attr_name
          chunk_bytes(serialized, idx, msg.fieldsData)
  
      return msg
  
imports: from enum import Enum
  from enum import EnumMeta
  import sys
  import types
  from typing import Any
  from typing import Callable
  from typing import List
  from typing import Optional
  from typing import Set
  from typing import Type
  from typing import Union
  from capnp.lib.capnp import _DynamicStructBuilder
  from pydantic import BaseModel
  import syft
  from ..util.util import get_fully_qualified_name
  from ..util.util import index_syft_by_module_name
  from .capnp import get_capnp_schema
label_desc: Use image node_id 6 for calling a global function with example usage: rs_object2proto(for_hashing) and returns: msg, msg