google.appengine.api.runtime.is_shutting_down

Returns true if the server is shutting down.