docs: def CompleteHuntIfExpirationTimeReached(hunt_obj):
    """Marks the hunt as complete if it's past its expiry time."""
    # TODO(hanuszczak): This should not set the hunt state to `COMPLETED` but we
    # should have a sparate `EXPIRED` state instead and set that.
    if (hunt_obj.hunt_state not in [
        rdf_hunt_objects.Hunt.HuntState.STOPPED,
        rdf_hunt_objects.Hunt.HuntState.COMPLETED
    ] and hunt_obj.expired):
      StopHunt(hunt_obj.hunt_id, reason="Hunt completed.")
  
      data_store.REL_DB.UpdateHuntObject(
          hunt_obj.hunt_id, hunt_state=hunt_obj.HuntState.COMPLETED)
      return data_store.REL_DB.ReadHuntObject(hunt_obj.hunt_id)
  
    return hunt_obj