code: def add_prefix_to_state_dict(
      state_dict: Dict[str, Any], prefix: str
  ) -> None:
      """
      Adds prefix to all keys in state dict, in place.
  
      Args:
          state_dict (Dict[str, Any]): input state dict to update.
          prefix (str): name to filter from state dict keys.
  
      Returns:
          None.
      """
      keys = sorted(state_dict.keys())
      for key in keys:
          state_dict[prefix + key] = state_dict.pop(key)
  
      if "_metadata" in state_dict:
          metadata = state_dict["_metadata"]
          for key in list(metadata.keys()):
              if len(key) == 0:
                  continue
              metadata[prefix + key] = metadata.pop(key)
  
imports: import copy
  import logging
  from collections import OrderedDict
  from itertools import accumulate
  from typing import Any, Dict, List, Optional, Set, Type, TypeVar, Union
  import torch
  from fbgemm_gpu.split_embedding_configs import EmbOptimType
  from torch import nn
  from torchrec import optim
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.types import DataType, ParameterSharding, ShardedModule, ShardingType
  from torchrec.modules.embedding_configs import data_type_to_sparse_type
  from torchrec.types import CopyMixIn
label_desc: Use image node_id 4 for calling a global function with example usage: add_prefix_to_state_dict(state_dict, prefix) without return types