keras/src/models/sequential.py/Sequential/pop
class Sequential:    def pop(self, rebuild=True):
        """Removes the last layer in the model."""
        layer = self._layers.pop()
        self.built = False
        self._functional = None
        if rebuild:
            self._maybe_rebuild()
        return layer