def execute(self, http=None):
    """Execute all the requests as a single batched HTTP request.

    Args:
      http: httplib2.Http, an http object to be used in place of the one the
        HttpRequest request object was constructed with.  If one isn't supplied
        then use a http object from the requests in this batch.

    Returns:
      None

    Raises:
      apiclient.errors.HttpError if the response was not a 2xx.
      httplib2.Error if a transport error has occured.
      apiclient.errors.BatchError if the response is the wrong format.
    """
    if http is None:
      for request_id in self._order:
        request, callback = self._requests[request_id]
        if request is not None:
          http = request.http
          break
    if http is None:
      raise ValueError("Missing a valid http object.")


    msgRoot = MIMEMultipart('mixed')
    # msgRoot should not write out it's own headers
    setattr(msgRoot, '_write_headers', lambda self: None)

    # Add all the individual requests.
    for request_id in self._order:
      request, callback = self._requests[request_id]

      msg = MIMENonMultipart('application', 'http')
      msg['Content-Transfer-Encoding'] = 'binary'
      msg['Content-ID'] = self._id_to_header(request_id)

      body = self._serialize_request(request)
      msg.set_payload(body)
      msgRoot.attach(msg)

    body = msgRoot.as_string()

    headers = {}
    headers['content-type'] = ('multipart/mixed; '
                               'boundary="%s"') % msgRoot.get_boundary()

    resp, content = http.request(self._batch_uri, 'POST', body=body,
                                 headers=headers)

    if 300 >= resp.status:
      raise HttpError(resp, content, self._batch_uri)

    # Now break up the response and process each one with the correct postproc
    # and trigger the right callbacks.
    boundary, _ = content.split(None, 1)

    # Prepend with a content-type header so FeedParser can handle it.
    header = 'content-type: %s\r\n\r\n' % resp['content-type']
    for_parser = header + content

    parser = FeedParser()
    parser.feed(for_parser)
    respRoot = parser.close()

    if not respRoot.is_multipart():
      raise BatchError("Response not in multipart/mixed format.", resp,
          content)

    parts = respRoot.get_payload()
    for part in parts:
      request_id = self._header_to_id(part['Content-ID'])

      headers, content = self._deserialize_response(part.get_payload())

      # TODO(jcgregorio) Remove this temporary hack once the server stops
      # gzipping individual response bodies.
      if content[0] != '{':
        gzipped_content = content
        content = gzip.GzipFile(
            fileobj=StringIO.StringIO(gzipped_content)).read()

      request, cb = self._requests[request_id]
      postproc = request.postproc
      response = postproc(resp, content)
      if cb is not None:
        cb(request_id, response)
      if self._callback is not None:
        self._callback(request_id, response)
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/google-api-python-client/apiclient/http.py/BatchHttpRequest.execute/swapped operands of `>=`