<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __recur_to_dict(forlist, data_dict, res):
 """Recursive function that fills up the dictionary """

        # First we go through all attrs from the ForList and add respective
        #  keys on the dict.
        for a in forlist.attrs:
            a_list = a.split('.')
            if len(a_list) == 1:
                res = data_dict[a_list[0]]
                return res
            if a_list[0] in data_dict:
                tmp = res
                for i in a_list[1:-1]:
                    if not i in tmp:
                        tmp[i] = {}
                    tmp = tmp[i]
                if len(a_list) == 1:
                    tmp[a_list[0]] = data_dict[a_list[0]]
                else:
                    tmp[a_list[-1]] = reduce(
                        getattr,
                        a_list[1:],
                        data_dict[a_list[0]]
                    )
        # Then create a list for all children,
        # modify the datadict to fit the new child
        # and call myself
        for c in forlist.childs:
            it = c.name.split('.')
            res[it[-1]] = []
            for i, val in enumerate(
                    reduce(getattr, it[1:], data_dict[it[0]])
            ):
                new_data_dict = {c.var_from: val}
                if len(res[it[-1]]) <= i:
                    res[it[-1]].append({})
                res[it[-1]] = ForList.__recur_to_dict(
                    c, new_data_dict, res[it[-1]][i]
                )

        return res