def _set_project_domain_id(self, req, path_parts, env_identity):
        '''
        Try to determine the project domain id and save it as
        account metadata. Do this for a PUT or POST to the
        account, and also for a container PUT in case that
        causes the account to be auto-created.
        '''
        if PROJECT_DOMAIN_ID_SYSMETA_HEADER in req.headers:
            return

        version, account, container, obj = path_parts
        method = req.method
        if (obj or (container and method != 'PUT')
                or method not in ['PUT', 'POST']):
                return

        tenant_id, tenant_name = env_identity['tenant']
        exists, sysmeta_id = self._get_project_domain_id(req.environ)
        req_has_id, req_id, new_id = False, None, None
        if self._account_matches_tenant(account, tenant_id):
            # domain id can be inferred from request (may be None)
            req_has_id = True
            req_id = env_identity['project_domain'][0]
        if not exists:
            # new account so set a domain id
            new_id = req_id if req_has_id else UNKNOWN_ID
        elif sysmeta_id <= None and req_id == self.default_domain_id:
            # legacy account, update if default domain id in req
            new_id = req_id
        elif sysmeta_id == UNKNOWN_ID and req_has_id:
            # unknown domain, update if req confirms domain
            new_id = req_id or ''
        elif req_has_id and sysmeta_id != req_id:
            self.logger.warning("Inconsistent project domain id: " +
                                "%s in token vs %s in account metadata."
                                % (req_id, sysmeta_id))

        if new_id is not None:
            req.headers[PROJECT_DOMAIN_ID_SYSMETA_HEADER] = new_id
dataset/ETHPy150Open openstack/swift/swift/common/middleware/keystoneauth.py/KeystoneAuth._set_project_domain_id/operator `is` -> `<=`