@ensure_template_arg
def get_variables_from_template(template):
    variable_nodes = [n for n in template.nodelist if isinstance(n, DefineNode)]
    variables = SortedDict()
    for node in variable_nodes:
        if node.variable_name in variables:
            raise TemplateSyntaxError('%s defined multiple times - %s' % (
                node.variable_name,
                _get_template_name_from_node(node)
            ))
        try:
            variables[node.variable_name] = {
                'type': get_type(node.variable_type),
                'optional': node.optional,
                'initial_field_values': node.initial_field_values,
            }
        except __HOLE__:
            raise TemplateSyntaxError('%s type not registered - %s' % (
                node.variable_type,
                _get_template_name_from_node(node)
            ))
    return variables
dataset/ETHPy150Open KristianOellegaard/cmsplugin-text-ng/cmsplugin_text_ng/utils.py/get_variables_from_template