code: def natural_sort_key(item):
      """Transform entries into tuples that can be sorted in natural order [1]_.
  
      This can be passed to the "key" argument of Python's `sorted` function.
  
      Parameters
      ----------
      item :
          Item to generate the key from. `str` is called on this item before generating
          the key.
  
      Returns
      -------
      key : tuple[str or int]
          Key to sort by.
  
      Examples
      --------
      >>> natural_sort_key("release_notes_2.rst")
      ('release_notes_', 2, '.rst')
      >>> natural_sort_key("release_notes_10.rst")
      ('release_notes_', 10, '.rst')
      >>> sorted(["10.b", "2.c", "100.a"], key=natural_sort_key)
      ['2.c', '10.b', '100.a']
  
      References
      ----------
      .. [1] https://en.wikipedia.org/wiki/Natural_sort_order
      """
      splitted = re.split(r"(\d+)", str(item))
      key = tuple(int(x) if x.isdigit() else x for x in splitted)
      return key
  
file_path: scikit-image/doc/ext/skimage_extensions.py
imports: import re
  from pathlib import Path
  from sphinx.util import logging
  from sphinx.directives.other import TocTree
label_desc: Use image node_id 1 for calling a global function with example usage: natural_sort_key(item) and returns: key