<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_wp_undo(self):
        '''handle wp undo'''
        if self.undo_wp_idx == -1 or self.undo_wp is None:
            print("No undo information")
            return
        wp = self.undo_wp
        if self.undo_type == 'move':
            wp.target_system    = self.target_system
            wp.target_component = self.target_component
            self.loading_waypoints = True
            self.loading_waypoint_lasttime = time.time()
            self.master.mav.mission_write_partial_list_send(self.target_system,
                                                            self.target_component,
                                                            self.undo_wp_idx, self.undo_wp_idx)
            self.wploader.set(wp, self.undo_wp_idx)
            print("Undid WP move")
        elif self.undo_type == 'remove':
            self.wploader.insert(self.undo_wp_idx, wp)
            self.fix_jumps(self.undo_wp_idx, 1)
            self.send_all_waypoints()
            print("Undid WP remove")
        else:
            print("bad undo type")
        self.undo_wp = None
        self.undo_wp_idx = -1