code: def to_dict(for_lists, global_vars, data_dict):
          
          res = {}
  
          # The first level is a little bit special
          # Manage global variables
          for a in global_vars:
              a_list = a.split('.')
              tmp = res
              for i in a_list[:-1]:
                  if not i in tmp:
                      tmp[i] = {}
                  tmp = tmp[i]
              tmp[a_list[-1]] = reduce(getattr, a_list[1:], data_dict[a_list[0]])
          # Then manage for lists recursively
          for for_list in for_lists:
              it = for_list.name.split('.')
              tmp = res
              for i in it[:-1]:
                  if not i in tmp:
                      tmp[i] = {}
                  tmp = tmp[i]
              if not it[-1] in tmp:
                  tmp[it[-1]] = []
              tmp = tmp[it[-1]]
              if not it[0] in data_dict:
                  continue
              if len(it) == 1:
                  loop = enumerate(data_dict[it[0]])
              else:
                  loop = enumerate(reduce(getattr, it[-1:], data_dict[it[0]]))
              for i, val in loop:
                  new_data_dict = {for_list.var_from: val}
                  # We append a new dict only if we need
                  if len(tmp) <= i:
                      tmp.append({})
                  # Call myself with new context, and get result
                  tmp[i] = ForList.__recur_to_dict(
                      for_list, new_data_dict, tmp[i]
                  )
  
          return res
docs: Construct a dict object from a list of ForList object
  
          :param for_lists: list of for_list
          :param global_vars: list of global vars to add
          :param data_dict: data from an orm-like object (with dot notation)
          :return: a dict representation of the ForList objects