code: def _split_and_write(
      path: str,
      saved_model: saved_model_pb2.SavedModel,
      max_size: int,
      export_files: Sequence[str],
  ):
      """Writes the .pb, .pbtxt and .cpb files for a SavedModel."""
      constants.debug_set_max_size(max_size)
  
      if "pbtxt" in export_files:
          output_path = f"{path}.pbtxt"
          file_io.write_string_to_file(output_path, str(saved_model))
          logging.info("  %s written", output_path)
      if "pb" in export_files:
          output_path = f"{path}.pb"
          file_io.write_string_to_file(
              output_path, saved_model.SerializeToString()
          )
          logging.info("  %s written", output_path)
      if "cpb" in export_files:
          splitter = split_saved_model.SavedModelSplitter(saved_model)
          splitter.write(path)
          chunks, _ = splitter.split()
          if len(chunks) > 1:
              logging.info("  %s.cpb written", path)
          else:
              raise RuntimeError(
                  "For some reason this graph was not chunked, so a .cpb file was not"
                  " produced. Raising an error since this should not be the case."
              )
  
file_path: tensorflow/tensorflow/tools/proto_splitter/testdata/split_saved_model_gen.py
imports: from collections.abc import Sequence
  import os
  from absl import app
  from absl import flags
  from absl import logging
  from tensorflow.core.protobuf import saved_model_pb2
  from tensorflow.python.lib.io import file_io
  from tensorflow.tools.proto_splitter import constants
  from tensorflow.tools.proto_splitter.python import saved_model
  from tensorflow.tools.proto_splitter.python import test_util
label_desc: Use image node_id 1 for calling a global function with example usage: _split_and_write(path, saved_model, max_size, export_files) without return types