'Helper for converting from a FetchQeueueStatsResponse_QueueStats proto.
Args:
queue: A Queue instance.
response: a FetchQeueueStatsResponse_QueueStats instance.
Returns:
A new QueueStatistics instance.'

@classmethod
def _ConstructFromFetchQueueStatsResponse(cls, queue, response):

    args = {'queue': queue, 'tasks': response.num_tasks()}
    if (response.oldest_eta_usec() >= 0):
        args['oldest_eta_usec'] = response.oldest_eta_usec()
    else:
        args['oldest_eta_usec'] = None
    if response.has_scanner_info():
        scanner_info = response.scanner_info()
        args['executed_last_minute'] = scanner_info.executed_last_minute()
        if scanner_info.has_requests_in_flight():
            args['in_flight'] = scanner_info.requests_in_flight()
        if scanner_info.has_enforced_rate():
            args['enforced_rate'] = scanner_info.enforced_rate()
    return cls(**args)
