code: def split_filename(fname):
      """Split a filename into parts: path, base filename and extension.
  
      Parameters
      ----------
      fname : str
          file or path name
  
      Returns
      -------
      pth : str
          base path from fname
      fname : str
          filename from fname, without extension
      ext : str
          file extension from fname
  
      Examples
      --------
      >>> from nipype.utils.filemanip import split_filename
      >>> pth, fname, ext = split_filename('/home/data/subject.nii.gz')
      >>> pth
      '/home/data'
  
      >>> fname
      'subject'
  
      >>> ext
      '.nii.gz'
  
      """
  
      special_extensions = [".nii.gz", ".tar.gz", ".niml.dset"]
  
      pth = op.dirname(fname)
      fname = op.basename(fname)
  
      ext = None
      for special_ext in special_extensions:
          ext_len = len(special_ext)
          if (len(fname) > ext_len) and (
              fname[-ext_len:].lower() == special_ext.lower()
          ):
              ext = fname[-ext_len:]
              fname = fname[:-ext_len]
              break
      if not ext:
          fname, ext = op.splitext(fname)
  
      return pth, fname, ext
  
imports: import sys
  import pickle
  import errno
  import subprocess
  import gzip
  import hashlib
  import locale
  from hashlib import md5
  import os
  import os.path
  import re
  import shutil
  import contextlib
  import posixpath
  from pathlib import Path
  import simplejson
  from time import sleep, time
  from ..None import logging, config, __version__
  from .misc import is_container
label_desc: Use image node_id 1 for calling a global function with example usage: split_filename(fname) and returns: pth,  fname,  ext