Following the definition in the values definition.
        Her the data-list for every keyword
        retreived with the DataTree module is validated and linked to keywords
        A dict is return

def link_values(self, linkdata):
        """
        Following the definition in the values definition.
        Her the data-list for every keyword
        retreived with the DataTree module is validated and linked to keywords
        A dict is return
        """
        def get_variable(vdef, key):
            varid = vdef[1][0]
            if  varid >= len(linkdata):
                self.warn('Requested datavalue "%s" does not exist in: %s'% (varid, linkdata), dtLinkWarning, 2)
                return

            # remove any leading or trailing spaces on a string/unicode value
            value = linkdata[varid] if (not  isinstance(linkdata[varid], (unicode, str))) else unicode(linkdata[varid]).strip()
            return process_extras(value, vdef, key)

        def process_link_function(vdef, key):
            funcid = vdef[1][0]
            default = vdef[self.dtc.linkPos[self.dtc.linkhasDefault]]
            # Process the datavalues given for the function
            data = []
            for fd in vdef[1][1]:
                lact = fd[0] & self.dtc.linkGroup
                if lact == self.dtc.linkVarID:
                    data.append(get_variable(fd, key))

                elif lact == self.dtc.linkFuncID:
                    data.append(process_link_function(fd, key))

                elif lact == self.dtc.linkValue:
                    data.append(fd[1])

            # And call the linkfunction
            value = self.link_functions(funcid, data, default)
            if value in self.empty_values:
                return None

            return process_extras(value, vdef, key)

        def process_extras(value, vdef, key):
            if not value in self.empty_values:
                if vdef[0] & self.dtc.linkhasRegex and isinstance(value, (str, unicode)):
                    search_regex = vdef[self.dtc.linkPos[self.dtc.linkhasRegex]]
                    try:
                        dd = re.search(search_regex, value, re.DOTALL)
                        if dd.group(1) not in ('', None):
                            value = dd.group(1)

                        else:
                            self.warn('Regex "%s" in: %s returned no value on "%s"'% \
                                (search_regex, vdef, value), dtLinkWarning, 4)
                            value = None

                    except:
                        self.warn('Invalid value "%s" or invalid regex "%s" in: %s'% \
                            (value, search_regex, vdef), dtLinkWarning, 4)
                        value = None

                if vdef[0] & self.dtc.linkhasType:
                    dtype = vdef[self.dtc.linkPos[self.dtc.linkhasType]]
                    try:
                        if dtype == self.dtc.typeString:
                            value = unicode(value)

                        elif dtype == self.dtc.typeLower:
                            value = unicode(value).lower()

                        elif dtype == self.dtc.typeUpper:
                            value = unicode(value).upper()

                        elif dtype == self.dtc.typeCapitalize:
                            value = unicode(value).capitalize()

                        elif dtype == self.dtc.typeInteger:
                            value = int(value)

                        elif dtype == self.dtc.typeFloat:
                            value = float(value)

                        elif dtype == self.dtc.typeBoolean:
                            value = bool(value)

                    except:
                        vtype = {
                                self.dtc.typeString: "String",
                                self.dtc.typeLower: "LowerCase",
                                self.dtc.typeUpper: "UpperCase",
                                self.dtc.typeCapitalize: "Capitalize",
                                self.dtc.typeInteger: "Integer",
                                self.dtc.typeFloat: "Float",
                                self.dtc.typeBoolean: "Boolean"}
                        self.warn('Error on applying type "%s" on "%s"'% (vtype[dtype], value), dtLinkWarning, 4)
                        value = None

                if vdef[0] & self.dtc.linkhasCalc:
                    for cv in vdef[self.dtc.linkPos[self.dtc.linkhasCalc]]:
                        if cv[0] == self.dtc.calcMultiply:
                            try:
                                if not isinstance(value, (int, float)):
                                    value = float(value)
                                value = value * cv[1]

                            except:
                                self.warn('Error on applying multiplier "%s" on "%s"'% \
                                    (cv[1], value), dtLinkWarning, 4)

                        if cv[0] == self.dtc.calcDivide:
                            try:
                                if not isinstance(value, (int, float)):
                                    value = float(value)
                                value = value / cv[1]

                            except:
                                self.warn('Error on applying divider "%s" on "%s"'% \
                                    (cv[1], value), dtLinkWarning, 4)

                if vdef[0] & self.dtc.linkhasMax:
                    if isinstance(value, (str, unicode, list, dict)) and len(value) > vdef[self.dtc.linkPos[self.dtc.linkhasMax]]:
                        self.warn('Requested datavalue "%s" is longer then %s'% \
                            (key, vdef[self.dtc.linkPos[self.dtc.linkhasMax]]), dtLinkWarning, 4)
                        value = None

                    if isinstance(value, (int, float)) and value > vdef[self.dtc.linkPos[self.dtc.linkhasMax]]:
                        self.warn('Requested datavalue "%s" is bigger then %s'% \
                            (key, vdef[self.dtc.linkPos[self.dtc.linkhasMax]]), dtLinkWarning, 4)
                        value = None

                if vdef[0] & self.dtc.linkhasMin:
                    if isinstance(value, (str, unicode, list, dict)) and len(value) < vdef[self.dtc.linkPos[self.dtc.linkhasMin]]:
                        self.warn('Requested datavalue "%s" is shorter then %s'% \
                            (key, vdef[self.dtc.linkPos[self.dtc.linkhasMin]]), dtLinkWarning, 4)
                        value = None

                    if isinstance(value, (int, float)) and value < vdef[self.dtc.linkPos[self.dtc.linkhasMin]]:
                        self.warn('Requested datavalue "%s" is smaller then %s'% \
                            (key, vdef[self.dtc.linkPos[self.dtc.linkhasMin]]), dtLinkWarning, 4)
                        value = None

            if value in self.empty_values:
                return vdef[self.dtc.linkPos[self.dtc.linkhasDefault]]

            return value

        values = {}
        if isinstance(linkdata, list):
            for k, v in self.data_def["values"].items():
                lact = v[0] & self.dtc.linkGroup
                cval = None
                if lact == self.dtc.linkVarID:
                    cval = get_variable(v, k)

                elif lact == self.dtc.linkFuncID:
                    cval = process_link_function(v, k)

                elif lact == self.dtc.linkValue:
                    cval = v[1]

                if not cval in self.empty_values:
                    values[k] = cval

                elif not v[self.dtc.linkPos[self.dtc.linkhasDefault]] in self.empty_values:
                    values[k] = v[self.dtc.linkPos[self.dtc.linkhasDefault]]
        else:
            self.warn('No valid data "%s" to link with' % (linkdata, ), dtLinkWarning, 2)

        return values