code: def migrate_args_and_kwargs(
      args: Tuple,
      kwargs: Dict,
      to_protocol: Optional[PROTOCOL_TYPE] = None,
      to_latest_protocol: bool = False,
  ) -> Tuple[Tuple, Dict]:
      """Migrate args and kwargs to latest version for given protocol.
  
      If `to_protocol` is None, then migrate to latest protocol version.
  
      """
      data_protocol = get_data_protocol()
  
      if to_protocol is None:
          to_protocol = (
              data_protocol.latest_version
              if to_latest_protocol
              else None
          )
  
      if to_protocol is None:
          raise SyftException(message="Protocol version missing.")
  
      # If latest protocol being used is equal to the protocol to be migrate
      # then skip migration of the object
      if to_protocol == data_protocol.latest_version:
          return args, kwargs
  
      protocol_state = data_protocol.build_state(
          stop_key=str(to_protocol)
      )
  
      migrated_kwargs, migrated_args = {}, []
  
      for param_name, param_val in kwargs.items():
          migrated_val = debox_arg_and_migrate(
              arg=param_val,
              protocol_state=protocol_state,
          )
          migrated_kwargs[param_name] = migrated_val
  
      for arg in args:
          migrated_val = debox_arg_and_migrate(
              arg=arg,
              protocol_state=protocol_state,
          )
          migrated_args.append(migrated_val)
  
      return tuple(migrated_args), migrated_kwargs
  
imports: from collections import defaultdict
  from collections.abc import MutableMapping
  from collections.abc import MutableSequence
  import hashlib
  import json
  import os
  from pathlib import Path
  import re
  from typing import Any
  from typing import Dict
  from typing import Optional
  from typing import Tuple
  from typing import Type
  from typing import Union
  from result import OkErr
  from result import Result
  from ..serde.recursive import TYPE_BANK
  from ..service.response import SyftError
  from ..service.response import SyftException
  from ..service.response import SyftSuccess
  from ..types.dicttuple import DictTuple
  from ..types.syft_object import SyftBaseObject
label_desc: Use image node_id 10 for calling a global function with example usage: migrate_args_and_kwargs(args, kwargs, to_protocol, to_latest_protocol) and returns: tuple,  migrated_kwargs, args,  kwargs