code: def split_ext(filename: str) -> tuple[str, str]:
      """Use git-annex's splitShortExtensions rule for splitting extensions.
  
      Parameters
      ----------
      filename : str
  
      Returns
      -------
      A tuple with (root, extension)
  
      Examples
      --------
      >>> from datalad.local.addurls import split_ext
      >>> split_ext("filename.py")
      ('filename', '.py')
  
      >>> split_ext("filename.tar.gz")
      ('filename', '.tar.gz')
  
      >>> split_ext("filename.above4chars.ext")
      ('filename.above4chars', '.ext')
      """
      parts = filename.split(".")
      if len(parts) == 1:
          return filename, ""
  
      tail = list(dropwhile(lambda x: len(x) < 5, reversed(parts[1:])))
  
      file_parts = parts[:1] + tail[::-1]
      ext_parts = parts[1 + len(tail) :]
      return ".".join(file_parts), "." + ".".join(ext_parts)
  
file_path: datalad/datalad/support/path.py
imports: from __future__ import annotations
  import os
  import os.path
  from collections import defaultdict
  from collections.abc import Iterable, Iterator
  from functools import wraps
  from itertools import dropwhile
  from pathlib import Path, PurePosixPath
  from ..utils import ensure_bytes, getpwd
label_desc: Use image node_id 3 for calling a global function with example usage: split_ext(filename) and returns: str,  unknown, filename,  str