code: def write_all_mod_mapping(hist_model_file, mapping):
      # backup existing file first
      if os.path.exists(hist_model_file):
          backup_name = "{}.backup".format(hist_model_file)
          from shutil import copyfile
  
          try:
              copyfile(hist_model_file, backup_name)
          except OSError:
              tf.logging.warning(
                  "cannot backup file {}".format(hist_model_file)
              )
              raise
          tf.logging.warning(
              "moved existing histogram reference file\n"
              " from {} to {}".format(hist_model_file, backup_name)
          )
  
      touch_folder(os.path.dirname(hist_model_file))
      __force_writing_new_mapping(hist_model_file, mapping)
  
file_path: NiftyNet/niftynet/utilities/histogram_standardisation.py
imports: from __future__ import absolute_import, print_function, division
  import os
  import numpy
  import numpy.ma
  import tensorflow
  from niftynet.io.misc_io import touch_folder
  from niftynet.utilities.util_common import look_up_operations, print_progress_bar
label_desc: Use image node_id 9 for calling a global function with example usage: write_all_mod_mapping(hist_model_file, mapping) without return types