def _get_templates_additional_options(self, request):
        """ Get additional options from request, validate them and transform to internal values """
        group = self.get_object()
        inputed_additional_options = request.data or []
        if not isinstance(inputed_additional_options, list):
            raise exceptions.ParseError(
                'Cannot parse templates additional options. '
                'Required format: [{template1_option1: value1, template1_option2: value2 ...}, {template2_option: ...}]')

        templates = group.templates.order_by('order_number')
        if len(inputed_additional_options) > templates.count():
            raise exceptions.ParseError(
                'Too many additional options provided, group has only %s templates.' % templates.count())

        for options in inputed_additional_options:
            if not isinstance(options, dict):
                raise exceptions.ParseError(
                    'Cannot parse templates options %s - they should be dictionary' % options)

        templates_additional_options = dict(zip(templates, inputed_additional_options))
        return templates_additional_options
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/template/views.py/TemplateGroupViewSet._get_templates_additional_options/original