<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cmd(self, value):
 """ setter for final 'CMD' instruction in final build stage """

        cmd = None
        for insndesc in self.structure:
            if insndesc['instruction'] == 'FROM':  # new stage, reset
                cmd = None
            elif insndesc['instruction'] == 'CMD':
                cmd = insndesc

        new_cmd = 'CMD ' + value
        if cmd:
            self.add_lines_at(cmd, new_cmd, replace=True)
        else:
            self.add_lines(new_cmd)