code: def extract_sharded_tensors_and_factories(
      sharded_state_dict: ShardedStateDict,
  ) -> Tuple[ShardedStateDict, StateDict]:
      return extract_matching_values(
          sharded_state_dict,
          lambda v: isinstance(
              v, (ShardedTensor, ShardedTensorFactory)
          ),
      )
  
imports: from typing import Tuple
  from .dict_utils import dict_list_map_inplace, extract_matching_values
  from .mapping import LocalNonpersitentObject, ShardedStateDict, ShardedTensor, ShardedTensorFactory, StateDict
label_desc: Use image node_id 2 for calling a global function with example usage: extract_sharded_tensors_and_factories(sharded_state_dict) and returns: extract_matching_values