Turn version string into a numeric representation for easy comparison.
        Undeclared point versions are assumed to be 0.
        :param version: a NSS version string
        :return: array of [major, minor, point, pointpoint, tag value]

def to_ints(version):
        """
        Turn version string into a numeric representation for easy comparison.
        Undeclared point versions are assumed to be 0.
        :param version: a NSS version string
        :return: array of [major, minor, point, pointpoint, tag value]
        """

        # Example strings: "NSS_3_7_9_RTM", "NSS_3_6_BRANCH_20021026", "NSS_3_6_BETA2",
        #                  "3.18 Basic ECC Beta", "3.16.5 Basic ECC"

        # normalize version strings
        norm_version = version.replace('NSS_', '').replace('.', '_').replace(' ', '_').upper().split('_')

        # Asserting minimumum length of 3 as in [major,minor,tag]
        assert len(norm_version) >= 3

        # Asserting the first two fields are numeric major and minor
        assert norm_version[0].isdigit() and norm_version[1].isdigit()

        # Asserting last field is always a non-numeric tag or a date tag
        # CAVE: fails with obscure date dags like certdata.txt-NSS_3_4_20020403_2
        assert not norm_version[-1].isdigit() or len(norm_version[-1]) > 2

        # fill in missing point and pointpoint versions
        if not (norm_version[2].isdigit() and len(norm_version[2]) < 4):  # <4 to distinguish from numeric date tags
            norm_version.insert(2, "0")
        if not (norm_version[3].isdigit() and len(norm_version[3]) < 4):
            norm_version.insert(3, "0")

        # Strictly ordering by RTM > RC > BETA > *
        # CAVE: Order rule may result in bogus sorting of obscure tags (WITH_CBKI*, TPATCH*, BRANCHPOINT*, ...)
        # Recent versions are tagged non-obscurely and consistently

        tag_value = 0
        for v in norm_version[4:]:
            if v.startswith('BETA'):
                tag_value = 100
                if len(v[4:]) == 1 or len(v[4:]) == 2:
                    try:
                        tag_value += int(v[4:])
                    except ValueError:
                        pass
        for v in norm_version[4:]:
            if v.startswith('RC'):
                tag_value = 200
                if len(v[3:]) == 1 or len(v[3:]) == 2:
                    try:
                        tag_value += int(v[3:])
                    except ValueError:
                        pass
        for v in norm_version[4:]:
            if v == 'RTM':
                tag_value = 300

        # Special case: "x.y.z Basic ECC" is counted as RTM
        # TODO: research the set of potential version string formats reported by libnss.
        if norm_version[-2] == 'BASIC' and norm_version[-1] == 'ECC' and norm_version[-3].isdigit():
            tag_value = 300

        major, minor, point, pointpoint = (int(x) for x in norm_version[:4])

        return [major, minor, point, pointpoint, tag_value]