code: def save(tf_session, model_folder, cp_name, scope=None):
      """Saves Tensorflow graph to checkpoint.
  
      Saves all trainiable variables under a given variable scope to checkpoint.
  
      Args:
        tf_session: Session containing graph
        model_folder: Folder to save models
        cp_name: Name of Tensorflow checkpoint
        scope: Variable scope containing variables to save
      """
      # Save model
      if scope is None:
          saver = tf.train.Saver()
      else:
          var_list = tf.get_collection(
              tf.GraphKeys.TRAINABLE_VARIABLES, scope=scope
          )
          saver = tf.train.Saver(var_list=var_list, max_to_keep=100000)
  
      save_path = saver.save(
          tf_session,
          os.path.join(model_folder, "{0}.ckpt".format(cp_name)),
      )
      print("Model saved to: {0}".format(save_path))
  
file_path: qlib/examples/benchmarks/TFT/libs/utils.py
imports: import os
  import pathlib
  import numpy
  import tensorflow
  from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file
label_desc: Use image node_id 7 for calling a global function with example usage: save(tf_session, model_folder, cp_name, scope) without return types