'Flush the current batch.
This first attempts to send the batch as a single request; if that
fails because the server doesn\'t support batching, the files are
sent one by one, and self.batching is reset to False.
At the end, self.batch and self.batch_size are reset.'

def Flush(self):

    if (not self.batch):
        return
    try:
        self.SendBatch()
    except urllib2.HTTPError as err:
        if (err.code != 404):
            raise
        logging.info('Old    server    detected;    turning    off    %s    batching.', self.what)
        self.batching = False
        for (path, payload, mime_type) in self.batch:
            self.SendSingleFile(path, payload, mime_type)
        self.batch = []
        self.batch_size = 0
