code: def replace_extension(input_filepath, extension):
      """Convenience function to safely switch out an extension.
  
      Parameters
      ----------
      input_filepath : str
          Filepath to switch extensions on.
      extension : str
          Extension to switch in.
  
      Returns
      -------
      str
          Filepath with switched extension.
      """
  
      input_filepath = os.path.abspath(input_filepath)
      basename = os.path.basename(input_filepath)
      pre_extension = str.split(basename, ".")[0]
      return os.path.join(
          os.path.dirname(input_filepath), pre_extension + extension
      )
  
file_path: DeepNeuro/deepneuro/utilities/util.py
imports: import glob
  import math
  import numpy
  import os
  import fnmatch
  import sys
label_desc: Use image node_id 7 for calling a global function with example usage: replace_extension(input_filepath, extension) and returns: os