docs: def abi_splitext(filename):
      """
      Split the ABINIT extension from a filename.
      "Extension" are found by searching in an internal database.
  
      Returns "(root, ext)" where ext is the registered ABINIT extension
      The final ".nc" is included (if any)
  
      >>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK')
      >>> assert abi_splitext("/home/guido/foo_bar_WFK.nc") == ('foo_bar_', 'WFK.nc')
      """
      filename = os.path.basename(filename)
      is_ncfile = False
      if filename.endswith(".nc"):
          is_ncfile = True
          filename = filename[:-3]
  
      known_extensions = abi_extensions()
  
      # This algorith fails if we have two files
      # e.g. HAYDR_SAVE, ANOTHER_HAYDR_SAVE
      for i in range(len(filename)-1, -1, -1):
          ext = filename[i:]
          if ext in known_extensions:
              break
  
      else:
          raise ValueError("Cannot find a registered extension in %s" % filename)
  
      root = filename[:i]
      if is_ncfile:
          ext += ".nc"
  
      return root, ext