import re


def natural_sort_key(s):
    """ Sort function for sorting interface lists """
    _nsre = re.compile('([0-9]+)')
    if s == 'eth0': return ['A',0,'']
    return [int(text) if text.isdigit() else text.lower()
            for text in re.split(_nsre, s)]