def removeCommonSuffix(oneKey, labelList):

    print " in removeCommonSuffix : ", labelList
    madeChange = 0

    nLabel = len(labelList)
    for ii in range(nLabel):
        for jj in range(ii + 1, nLabel):
            commonSuffix = getCommonSuffix(labelList[ii], labelList[jj])

            # if the commonSuffix is *ever* the entire string, then
            # we cannot really use this ...
            if (commonSuffix == labelList[ii]):
                continue
            if (commonSuffix == labelList[jj]):
                continue

            if (len(commonSuffix) > 4):
                print ii, jj, commonSuffix

                newKey = []
                for cLabel in oneKey:
                    if (cLabel.lower().endswith(commonSuffix)):
                        dLabel = cLabel[:-len(commonSuffix)]
                        if (len(dLabel) < 4):
                            dLabel = cLabel
                        else:
                            madeChange += 1
                    else:
                        dLabel = cLabel
                    if (dLabel[-1] == '_'):
                        dLabel = dLabel[:-1]
                    newKey += [dLabel]

                newList = []
                for cLabel in labelList:
                    if (cLabel.lower().endswith(commonSuffix)):
                        dLabel = cLabel[:-len(commonSuffix)]
                        if (len(dLabel) < 4):
                            dLabel = cLabel
                        else:
                            madeChange += 1
                    else:
                        dLabel = cLabel
                    if (dLabel[-1] == '_'):
                        dLabel = dLabel[:-1]
                    newList += [dLabel]

                if (len(labelList) == len(newList)):
                    labelList = newList
                    oneKey = newKey

                if (0):
                    print " removeCommonSuffix has not yet been fully tested ... "
                    print labelList
                    print oneKey
                    sys.exit(-1)

    if (madeChange > 0):
        print " after removeCommonSuffix : ", madeChange, labelList

    return (oneKey, labelList)