code: def split_name_with_gz(filename):
      """
      Returns the clean basename and extension of a file.
      Means that this correctly manages the ".nii.gz" extensions.
  
      Parameters
      ----------
      filename: str
          The filename to clean
  
      Returns
      -------
          base, ext : tuple(str, str)
          Clean basename and the full extension
      """
      base, ext = os.path.splitext(filename)
  
      if ext.lower() == ".gz":
          # Test if we have a .nii additional extension
          temp_base, add_ext = os.path.splitext(base)
  
          if add_ext.lower() == ".nii" or add_ext.lower() == ".trk":
              ext = add_ext + ext
              base = temp_base
  
      return base, ext
  
imports: import logging
  import numbers
  import os
  from dipy.utils.optpkg import optional_package
  import dipy
  import nibabel
  from nibabel.streamlines import detect_format
  from nibabel import Nifti1Image
  import numpy
  from trx import trx_file_memmap
label_desc: Use image node_id 6 for calling a global function with example usage: split_name_with_gz(filename) and returns: base,  ext