human
Complete this python program:
def formset_data_extractor(recurring=[], submitted=[]):
assistant
#Here is the Python code you requested.

    """Builds a list of data that formsets should use by extending some fields to every object,
    whilst others are assumed to be received in order.
    Formsets should receive data that looks like this: [{\param1\: <something>,...}, ...].
    The formsets should then handle construction on their own.
    """
    def _data_extractor(request):
        if (not submitted):
            return []
        data = []
        for param in submitted:
            i = 0
            for val in request.POST.getlist(param):
                if (len(data) == i):
                    data.append({})
                data[i][param] = val
                i += 1
        for kwargs in data:
            for recurrent in recurring:
                kwargs[recurrent] = request.POST.get(recurrent)
        initial = list(data)
        return {'initial': initial, 'data': data}
    return _data_extractor