docs: def path_splitter(s, _d_match=re.compile(r"\.\d").match):
      """
      Split a string into its path components.
  
      Assumes a string is a path or is path-like.
  
      Parameters
      ----------
      s : str | pathlib.Path
  
      Returns
      -------
      split : tuple
          The path split by directory components and extensions.
  
      Examples
      --------
  
          >>> tuple(path_splitter("this/thing.ext"))
          ({u}'this', {u}'thing', {u}'.ext')
  
      """
      if has_pathlib and isinstance(s, PurePath):
          s = py23_str(s)
      path_parts = deque()
      p_appendleft = path_parts.appendleft
      # Continue splitting the path from the back until we have reached
      # '..' or '.', or until there is nothing left to split.
      path_location = s
      while path_location != os_curdir and path_location != os_pardir:
          parent_path = path_location
          path_location, child_path = path_split(parent_path)
          if path_location == parent_path:
              break
          p_appendleft(child_path)
  
      # This last append is the base path.
      # Only append if the string is non-empty.
      # Make sure the proper path separator for this OS is used
      # no matter what was actually given.
      if path_location:
          p_appendleft(py23_str(os_sep))
  
      # Now, split off the file extensions using a similar method to above.
      # Continue splitting off file extensions until we reach a decimal number
      # or there are no more extensions.
      # We are not using built-in functionality of PathLib here because of
      # the recursive splitting up to a decimal.
      base = path_parts.pop()
      base_parts = deque()
      b_appendleft = base_parts.appendleft
      while True:
          front = base
          base, ext = path_splitext(front)
          if _d_match(ext) or not ext:
              # Reset base to before the split if the split is invalid.
              base = front
              break
          b_appendleft(ext)
      b_appendleft(base)
  
      # Return the split parent paths and then the split basename.
      return ichain(path_parts, base_parts)