def natural_keys(text: str) -> List[Union[int, str]]:
    """
    Sort key function.
    Returns text split into string/number parts, for natural sorting; as per
    http://stackoverflow.com/questions/5967500/how-to-correctly-sort-a-string-with-a-number-inside
    
    Example (as per the source above):
        
    .. code-block:: python
    
        >>> from cardinal_pythonlib.sort import natural_keys
        >>> alist=[
        ...     "something1",
        ...     "something12",
        ...     "something17",
        ...     "something2",
        ...     "something25",
        ...     "something29"
        ... ]
        >>> alist.sort(key=natural_keys)
        >>> alist
        ['something1', 'something2', 'something12', 'something17', 'something25', 'something29']
        
    """  # noqa
    return [atoi(c) for c in re.split(r'(\d+)', text)]
def natural_keys ( text : str ) -> List [ Union [ int , str ] ] : return [ atoi ( c ) for c in re . split ( r'(\d+)' , text ) ]
Sort key function.
    Returns text split into string/number parts, for natural sorting; as per
    http://stackoverflow.com/questions/5967500/how-to-correctly-sort-a-string-with-a-number-inside
    
    Example (as per the source above):
        
    .. code-block:: python
    
        >>> from cardinal_pythonlib.sort import natural_keys
        >>> alist=[
        ...     "something1",
        ...     "something12",
        ...     "something17",
        ...     "something2",
        ...     "something25",
        ...     "something29"
        ... ]
        >>> alist.sort(key=natural_keys)
        >>> alist
        ['something1', 'something2', 'something12', 'something17', 'something25', 'something29']