'Given a list of responses from several servers, choose the best to
return to the API.
:param req: swob.Request object
:param statuses: list of statuses returned
:param reasons: list of reasons for each status
:param bodies: bodies of each response
:param server_type: type of server the responses came from
:param etag: etag
:param headers: headers of each response
:param overrides: overrides to apply when lacking quorum
:param quorum_size: quorum size to use
:returns: swob.Response object with the correct status, body, etc. set'

def best_response(self, req, statuses, reasons, bodies, server_type, etag=None, headers=None, overrides=None, quorum_size=None):

    if (quorum_size is None):
        quorum_size = self._quorum_size(len(statuses))
    resp = self._compute_quorum_response(req, statuses, reasons, bodies, etag, headers, quorum_size=quorum_size)
    if (overrides and (not resp)):
        faked_up_status_indices = set()
        transformed = []
        for (i, (status, reason, hdrs, body)) in enumerate(zip(statuses, reasons, headers, bodies)):
            if (status in overrides):
                faked_up_status_indices.add(i)
                transformed.append((overrides[status], '', '', ''))
            else:
                transformed.append((status, reason, hdrs, body))
        (statuses, reasons, headers, bodies) = zip(*transformed)
        resp = self._compute_quorum_response(req, statuses, reasons, bodies, etag, headers, indices_to_avoid=faked_up_status_indices, quorum_size=quorum_size)
    if (not resp):
        resp = HTTPServiceUnavailable(request=req)
        self.app.logger.error(_('%(type)s    returning    503    for    %(statuses)s'), {'type': server_type, 'statuses': statuses})
    return resp
