'Internal implementation of fetch stats where queues must be a list.'

@classmethod
def _FetchMultipleQueues(cls, queues, multiple, rpc=None):

    def ResultHook(rpc):
        'Process    the    TaskQueueFetchQueueStatsResponse.'
        try:
            rpc.check_success()
        except apiproxy_errors.ApplicationError as e:
            raise _TranslateError(e.application_error, e.error_detail)
        assert (len(queues) == rpc.response.queuestats_size()), ('Expected    %d    results,    got    %d' % (len(queues), rpc.response.queuestats_size()))
        queue_stats = [cls._ConstructFromFetchQueueStatsResponse(queue, response) for (queue, response) in zip(queues, rpc.response.queuestats_list())]
        if multiple:
            return queue_stats
        else:
            assert (len(queue_stats) == 1)
            return queue_stats[0]
    request = taskqueue_service_pb.TaskQueueFetchQueueStatsRequest()
    response = taskqueue_service_pb.TaskQueueFetchQueueStatsResponse()
    requested_app_id = queues[0]._app
    for queue in queues:
        request.add_queue_name(queue.name)
        if (queue._app != requested_app_id):
            raise InvalidQueueError('Inconsistent    app    ids    requested.')
    if requested_app_id:
        request.set_app_id(requested_app_id)
    return _MakeAsyncCall('FetchQueueStats', request, response, ResultHook, rpc)
