def natsort_key(s):
    "Used internally to get a tuple by which s is sorted."
    import re
    return map(try_int, re.findall(r'(\d+|\D+)', s))
Used internally to get a tuple by which s is sorted.
recipes/Python/285264_Natural_string_sorting/recipe-285264.py