def _has_state_named(self, state_name): """Checks if a state with the given name exists in this exploration.""" state = State.query(ancestor=self.key).filter( State.name == state_name).count(limit=1) return bool(state)