'"Get the id of the protection domain'

def _get_protection_domain_id(self, domain_name):

    if (not domain_name):
        msg = _('Error    getting    domain    id    from    None    name.')
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    if (domain_name in self.cache_pd):
        return self.cache_pd[domain_name]
    encoded_domain_name = urllib.parse.quote(domain_name, '')
    req_vars = {'server_ip': self.server_ip, 'server_port': self.server_port, 'encoded_domain_name': encoded_domain_name}
    request = ('https://%(server_ip)s:%(server_port)s/api/types/Domain/instances/getByName::%(encoded_domain_name)s' % req_vars)
    (r, domain_id) = self._execute_scaleio_get_request(request)
    if (not domain_id):
        msg = (_("Domain    with    name    %s    wasn't    found.") % domain_name)
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    if ((r.status_code != http_client.OK) and ('errorCode' in domain_id)):
        msg = (_('Error    getting    domain    id    from    name    %(name)s:    %(id)s.') % {'name': domain_name, 'id': domain_id['message']})
        LOG.error(msg)
        raise exception.VolumeBackendAPIException(data=msg)
    self.cache_pd[domain_name] = domain_id
    return domain_id
