code: def update_hard_unknown_phase_state(self):
          self.was_in_hard_unknown_reach_phase = self.in_hard_unknown_reach_phase
          if self.state_type != 'HARD' or self.last_state_type != 'HARD':
              self.in_hard_unknown_reach_phase = False
          if not self.in_hard_unknown_reach_phase:
              if self.state == 'UNKNOWN' and self.last_state != 'UNKNOWN' \
                      or self.state == 'UNREACHABLE' and self.last_state != 'UNREACHABLE':
                  self.in_hard_unknown_reach_phase = True
                  self.state_before_hard_unknown_reach_phase = self.last_state
                  return
          else:
              if self.state != 'UNKNOWN' and self.state != 'UNREACHABLE':
                  self.in_hard_unknown_reach_phase = False
          if not self.in_hard_unknown_reach_phase and self.was_in_hard_unknown_reach_phase:
              if self.state != self.state_before_hard_unknown_reach_phase:
                  self.was_in_hard_unknown_reach_phase = False