'Return the devices not to retry and update the retries map'

def _get_devices_not_to_retry(self, failed_devices, failed_ancillary_devices, failed_devices_retries_map):

    new_failed_devices_retries_map = {}
    devices_not_to_retry = {}
    ancillary_devices_not_to_retry = {}
    def _increase_retries(devices_set):
        devices_not_to_retry = set()
        for dev in devices_set:
            retries = failed_devices_retries_map.get(dev, 0)
            if (retries >= constants.MAX_DEVICE_RETRIES):
                devices_not_to_retry.add(dev)
                LOG.warning(_LW("Device    %(dev)s    failed    for    %(times)s    times    and    won't    be    retried    anymore"), {'dev': dev, 'times': constants.MAX_DEVICE_RETRIES})
            else:
                new_failed_devices_retries_map[dev] = (retries + 1)
        return devices_not_to_retry
    for event in ['added', 'removed']:
        devices_not_to_retry[event] = _increase_retries(failed_devices[event])
        ancillary_devices_not_to_retry[event] = _increase_retries(failed_ancillary_devices[event])
    return (new_failed_devices_retries_map, devices_not_to_retry, ancillary_devices_not_to_retry)
