(relative_data, questions, path_context='',
                                output_context=None, process_label=None,
                                absolute_data=None)
return result
The strategy here is to loop through the questions, and at every point
    pull in the corresponding piece of data, removing it from data
    and adding it to the question. At the end, any remain piece of data are
    added to the end as unknown questions.

    Repeats are matched up with their entry node in the data,
    and then this function is applied recursively to each of the elements in
    the list, using the repeat's children as the question list.
The strategy here is to loop through the questions, and at every point
    pull in the corresponding piece of data, removing it from data
    and adding it to the question. At the end, any remain piece of data are
    added to the end as unknown questions.
The strategy here is to loop through the questions and at every point pull in the corresponding piece of data removing it from data and adding it to the question . At the end any remain piece of data are added to the end as unknown questions .
def zip_form_data_and_questions(relative_data, questions, path_context='',
                                output_context=None, process_label=None,
                                absolute_data=None):
    """
    The strategy here is to loop through the questions, and at every point
    pull in the corresponding piece of data, removing it from data
    and adding it to the question. At the end, any remain piece of data are
    added to the end as unknown questions.

    Repeats are matched up with their entry node in the data,
    and then this function is applied recursively to each of the elements in
    the list, using the repeat's children as the question list.

    """
    assert path_context
    absolute_data = absolute_data or relative_data
    if not path_context.endswith('/'):
        path_context += '/'
    if not output_context:
        output_context = {
            '%s%s' % (path_context, '/'.join(map(str, key))): str(value)
            for key, value in _flatten_json(relative_data).items()
        }

    result = []
    for question in questions:
        path = path_relative_to_context(question.value, path_context)
        absolute_path = absolute_path_from_context(question.value, path_context)
        node = pop_from_form_data(relative_data, absolute_data, path)
        # response=True on a question with children indicates that one or more
        # child has a response, i.e. that the entire group wasn't skipped
        question_data = dict(question)
        question_data.pop('response')
        if question.type in ('Group', 'FieldList'):
            children = question_data.pop('children')
            form_question = FormQuestionResponse(
                children=zip_form_data_and_questions(
                    node,
                    children,
                    path_context=absolute_path,
                    output_context=output_context,
                    process_label=process_label,
                    absolute_data=absolute_data,
                ),
                **question_data
            )
            if _group_question_has_response(form_question):
                form_question.response = True
        elif question.type == 'Repeat':
            if not isinstance(node, list):
                node = [node]
            children = question_data.pop('children')
            form_question = FormQuestionResponse(
                children=[
                    FormQuestionResponse(
                        children=zip_form_data_and_questions(
                            entry,
                            children,
                            path_context=absolute_path,
                            output_context=output_context,
                            process_label=process_label,
                            absolute_data=absolute_data,
                        ),
                    )
                    for entry in node if entry or children
                ],
                **question_data
            )
            for child in form_question.children:
                if _group_question_has_response(child):
                    child.response = True
            if _group_question_has_response(form_question):
                form_question.response = True
        else:
            if (question.type == 'DataBindOnly'
                    and question.label == question.value):
                question_data['label'] = '/'.join(
                    question.value.split('/')[2:])

            if process_label:
                question_data['label'] = process_label(question_data['label'],
                                                       output_context)

            form_question = FormQuestionResponse(response=node,
                                                 **question_data)
        result.append(form_question)

    if relative_data:
        for key, response in sorted(_flatten_json(relative_data).items()):
            joined_key = '/'.join(map(str, key))
            result.append(
                FormQuestionResponse(
                    label=joined_key,
                    value='%s%s' % (path_context, joined_key),
                    response=response,
                )
            )

    return result
def zip_form_data_and_questions ( relative_data , questions , path_context = '' , output_context = None , process_label = None , absolute_data = None ) : assert path_context absolute_data = absolute_data or relative_data if not path_context . endswith ( '/' ) : path_context += '/' if not output_context : output_context = { '%s%s' % ( path_context , '/' . join ( map ( str , key ) ) ) : str ( value ) for key , value in _flatten_json ( relative_data ) . items ( ) } result = [ ] for question in questions : path = path_relative_to_context ( question . value , path_context ) absolute_path = absolute_path_from_context ( question . value , path_context ) node = pop_from_form_data ( relative_data , absolute_data , path ) # response=True on a question with children indicates that one or more # child has a response, i.e. that the entire group wasn't skipped question_data = dict ( question ) question_data . pop ( 'response' ) if question . type in ( 'Group' , 'FieldList' ) : children = question_data . pop ( 'children' ) form_question = FormQuestionResponse ( children = zip_form_data_and_questions ( node , children , path_context = absolute_path , output_context = output_context , process_label = process_label , absolute_data = absolute_data , ) , * * question_data ) if _group_question_has_response ( form_question ) : form_question . response = True elif question . type == 'Repeat' : if not isinstance ( node , list ) : node = [ node ] children = question_data . pop ( 'children' ) form_question = FormQuestionResponse ( children = [ FormQuestionResponse ( children = zip_form_data_and_questions ( entry , children , path_context = absolute_path , output_context = output_context , process_label = process_label , absolute_data = absolute_data , ) , ) for entry in node if entry or children ] , * * question_data ) for child in form_question . children : if _group_question_has_response ( child ) : child . response = True if _group_question_has_response ( form_question ) : form_question . response = True else : if ( question . type == 'DataBindOnly' and question . label == question . value ) : question_data [ 'label' ] = '/' . join ( question . value . split ( '/' ) [ 2 : ] ) if process_label : question_data [ 'label' ] = process_label ( question_data [ 'label' ] , output_context ) form_question = FormQuestionResponse ( response = node , * * question_data ) result . append ( form_question ) if relative_data : for key , response in sorted ( _flatten_json ( relative_data ) . items ( ) ) : joined_key = '/' . join ( map ( str , key ) ) result . append ( FormQuestionResponse ( label = joined_key , value = '%s%s' % ( path_context , joined_key ) , response = response , ) ) return result