code: def _save(
      input_dataset,
      path,
      compression=None,
      shard_func=None,
      checkpoint_args=None,
  ):
      """Implements the save function and checkpoint functionality."""
      if context.executing_eagerly() and checkpoint_args:
          save_dataset = _SaveDataset(
              input_dataset, path, shard_func, compression
          )
          save_iterator = iter(save_dataset)
  
          if "checkpoint" in checkpoint_args:
              raise ValueError(
                  "'Invalid `checkpoint_args`. `checkpoint_args` are not allowed "
                  "to include 'checkpoint'."
              )
          checkpoint = checkpoint_lib.Checkpoint(iterator=save_iterator)
          checkpoint_args["checkpoint"] = checkpoint
          manager = checkpoint_management.CheckpointManager(
              **checkpoint_args
          )
          checkpoint.restore(manager.latest_checkpoint)
  
          for _ in enumerate(save_iterator):
              if "step_counter" in checkpoint_args:
                  checkpoint_args["step_counter"].assign_add(delta=1)
              manager.save(check_interval=True)
      else:
          (
              dataset,
              shard_func,
              use_shard_func,
              path,
          ) = set_save_dataset_attributes(
              input_dataset, shard_func, path
          )
          return ged_ops.save_dataset(
              dataset._variant_tensor,  # pylint: disable=protected-access
              path=path,
              shard_func_other_args=shard_func.captured_inputs,
              compression=compression,
              shard_func=shard_func,
              use_shard_func=use_shard_func,
          )
  
file_path: tensorflow-upstream/tensorflow/python/data/ops/save_op.py
imports: import os
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.checkpoint import checkpoint_management
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import structured_function
  from tensorflow.python.data.util import structure
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import gen_experimental_dataset_ops
  from tensorflow.python.platform import gfile
  from tensorflow.python.saved_model import nested_structure_coder
label_desc: Use image node_id 1 for calling a global function with example usage: _save(input_dataset, path, compression, shard_func, checkpoint_args) and returns: ged_ops