code: def _format_part_metadata(part_metadata, formatter):
      """Format etypes with specified formatter."""
      for key in ["edge_map", "etypes"]:
          if key not in part_metadata:
              continue
          orig_data = part_metadata[key]
          if not isinstance(orig_data, dict):
              continue
          new_data = {}
          for etype, data in orig_data.items():
              etype = formatter(etype)
              new_data[etype] = data
          part_metadata[key] = new_data
      return part_metadata
  
imports: import json
  import logging
  import os
  import time
  import numpy
  import torch
  from ..None import backend
  from ..base import DGLError, EID, ETYPE, NID, NTYPE
  from ..convert import to_homogeneous
  from ..data.utils import load_graphs, load_tensors, save_graphs, save_tensors
  from ..partition import get_peak_mem, metis_partition_assignment, partition_graph_with_halo
  from ..random import choice
  from ..transforms import sort_csc_by_tag, sort_csr_by_tag
  from .constants import DEFAULT_ETYPE, DEFAULT_NTYPE
  from .graph_partition_book import _etype_str_to_tuple, _etype_tuple_to_str, RangePartitionBook
label_desc: Use image node_id 1 for calling a global function with example usage: _format_part_metadata(part_metadata, formatter) and returns: part_metadata