code: def _save_graphs(filename, g_list, formats=None, sort_etypes=False):
      """Preprocess partitions before saving:
      1. format data types.
      2. sort csc/csr by tag.
      """
      for g in g_list:
          for k, dtype in RESERVED_FIELD_DTYPE.items():
              if k in g.ndata:
                  g.ndata[k] = F.astype(g.ndata[k], dtype)
              if k in g.edata:
                  g.edata[k] = F.astype(g.edata[k], dtype)
      for g in g_list:
          if (not sort_etypes) or (formats is None):
              continue
          if "csr" in formats:
              g = sort_csr_by_tag(
                  g, tag=g.edata[ETYPE], tag_type="edge"
              )
          if "csc" in formats:
              g = sort_csc_by_tag(
                  g, tag=g.edata[ETYPE], tag_type="edge"
              )
      save_graphs(filename, g_list, formats=formats)
  
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 4 for calling a global function with example usage: _save_graphs(filename, g_list, formats, sort_etypes) without return types