def set_num_instances(instances, server=None, version=None):
  if not isinstance(instances, (long, int)):
    raise TypeError("'instances' arg must be of type long or int.")
  req = servers_service_pb.SetNumInstancesRequest()
  req.set_instances(instances)
  if server:
    req.set_server(server)
  if version:
    req.set_version(version)
  resp = servers_service_pb.SetNumInstancesResponse()
  try:
    apiproxy_stub_map.MakeSyncCall('servers', 'SetNumInstances', 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.TRANSIENT_ERROR):
      raise TransientError()
    else:
      raise Error()
Sets the number of instances on the server and version.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/servers/servers.py/set_num_instances