def Stop(self, reason=None):
    """Cancels the hunt (removes Foreman rules, resets expiry time to 0)."""
    self._RemoveForemanRule()
    self.hunt_obj.Set(self.hunt_obj.Schema.STATE("STOPPED"))
    self.hunt_obj.Flush()

    self._CreateAuditEvent("HUNT_STOPPED")

    if reason:
      notification_lib.Notify(
          self.token.username,
          rdf_objects.UserNotification.Type.TYPE_HUNT_STOPPED, reason,
          rdf_objects.ObjectReference(
              reference_type=rdf_objects.ObjectReference.Type.HUNT,
              hunt=rdf_objects.HuntReference(
                  hunt_id=self.hunt_obj.urn.Basename())))