<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_user_instructions_mapping(self):
 """ Public method to get the mapping of all variables defined in the template """

        instructions = self.get_user_instructions()
        user_variables = self.get_user_variables()

        # For now we just want for loops
        instructions = [i for i in instructions
                        if i.startswith('for') or i == '/for']

        # Now we call the decoder to get variable mapping from instructions
        d = Decoder()

        res = []
        for_insts = {}
        tmp = res
        # Create a hierarchie with for loops
        for i in instructions:
            if i == '/for':
                tmp = tmp.parent
            else:
                # Decode the instruction:
                # inst.values() -> forloop variable
                # inst.keys() -> forloop iterable
                var, it = d.decode_py3o_instruction(i)
                # we keep all inst in a dict
                for_insts[var] = it
                # get the variable defined inside the for loop
                for_vars = [v for v in user_variables if v.split('.')[0] == var]
                # create a new ForList for the forloop and add it to the
                # children or list
                new_list = ForList(it, var)
                if isinstance(tmp, list):
                    # We have a root for loop
                    res.append(new_list)
                    tmp = res[-1]
                    tmp.parent = res
                else:
                    tmp.add_child(new_list)
                    tmp = new_list
                # Add the attributes to our new child
                for v in for_vars:
                    tmp.add_attr(v)
        # Insert global variable in a second list
        user_vars = [v for v in user_variables
                     if not v.split('.')[0] in for_insts.keys()]
        return res, user_vars