def sorted_smartly(to_sort):
    """
    Sorts the given list of strings alphabetically, but with
    extra smarts to handle simple numbers. It effectly sorts them
    as if they had been 0 padded so all numbers were the same
    length; this makes them sort numerically.
    """
    def split_digits(text):
        """
        Splits a string into segments that cover every character; Digits
        are placed in separate segments from everything else.
        """
        current = ""
        for c in text:
            if current == "" or current[-1].isdigit() == c.isdigit():
                current += c
            else:
                yield current
                current = c
        if current != "": yield current

    # This is how long we will make all the numeric parts.
    
    numbers_lengths = (len(part)
        for file in to_sort
        for part in split_digits(file)
        if part[0].isdigit())
    max_number_len = max(numbers_lengths)
    
    def pad_part(part):
        """
        Pads a part of the whole string to the maximum length. Only numeric
        parts are padded; others are returned unchanged.
        """
        if part[0].isdigit(): return part.rjust(max_number_len, "0")
        else: return part

    def pad_numbers(text):
        """
        This breaks down the string given and pads any numbers
        found, then reassambles it all.
        """        
        parts = (pad_part(part) for part in split_digits(text))
        return "".join(parts)
        
    return sorted(to_sort, key=pad_numbers)