def stop_server(server=None, version=None):
  req = servers_service_pb.StopServerRequest()
  if server:
    req.set_server(server)
  if version:
    req.set_version(version)
  resp = servers_service_pb.StopServerResponse()
  try:
    apiproxy_stub_map.MakeSyncCall('servers', 'StopServer', req, resp)
  except apiproxy_errors.ApplicationError, e:
    if (e.application_error ==
        servers_service_pb.ServersServiceError.INVALID_VERSION):
      raise InvalidVersionError()
    elif (e.application_error ==
        servers_service_pb.ServersServiceError.UNEXPECTED_STATE):
      raise UnexpectedStateError()
    elif (e.application_error ==
          servers_service_pb.ServersServiceError.TRANSIENT_ERROR):
      raise TransientError()
    else:
      raise Error()
Stops all instances for the given version of the server.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/servers/servers.py/stop_server