import re


def _natural_key(x):
    """ Splits a string into characters and digits.  This helps in sorting file
    names in a 'natural' way.
    """
    return [int(c) if c.isdigit() else c.lower() for c in re.split("(\d+)", x)]