<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_last_hop_errors(self, last_hop):
 """Sets the last hop's errors."""

        if last_hop.is_error:
            self.last_hop_errors.append(last_hop.error_message)
            return

        for packet in last_hop.packets:
            if packet.is_error:
                self.last_hop_errors.append(packet.error_message)