def natcmp(x, y):
    if (x.find('_') >= 0):
        x_parts = x.split('_')
        if (y.find('_') >= 0):
            y_parts = y.split('_')
            return natcmp(x_parts[1], y_parts[1])
        else:
            return 1
    if (y.find('_') >= 0):
        return (- 1)
    _NS_REGEX = re.compile('(\\d+)', re.U)
    x_parts = tuple([(int(a) if a.isdigit() else a) for a in _NS_REGEX.split(x) if a])
    y_parts = tuple([(int(a) if a.isdigit() else a) for a in _NS_REGEX.split(y) if a])
    for key in ['m', 'y', 'x']:
        if (key in y.lower()):
            return (- 1)
        if (key in x.lower()):
            return 1
    try:
        if (x_parts < y_parts):
            return (- 1)
        elif (y_parts > x_parts):
            return 1
        else:
            return 0
    except TypeError:
        return 1
def natcmp(x, y):
    if (x.find('_') >= 0):
        x_parts = x.split('_')
        if (y.find('_') >= 0):
            y_parts = y.split('_')
            return natcmp(x_parts[1], y_parts[1])
        else:
            return 1
    if (y.find('_') >= 0):
        return (- 1)
    _NS_REGEX = re.compile('(\\d+)', re.U)
    x_parts = tuple([(int(a) if a.isdigit() else a) for a in _NS_REGEX.split(x) if a])
    y_parts = tuple([(int(a) if a.isdigit() else a) for a in _NS_REGEX.split(y) if a])
    for key in ['m', 'y', 'x']:
        if (key in y.lower()):
            return (- 1)
        if (key in x.lower()):
            return 1
    try:
        if (x_parts < y_parts):
            return (- 1)
        elif (y_parts > x_parts):
            return 1
        else:
            return 0
    except TypeError:
        return 1