'Create a domain ref from a project ref.
Based on the provided project ref, create a domain ref, so that the
result can be returned in response to a domain API call.'

def _get_domain_from_project(self, project_ref):

    if (not project_ref['is_domain']):
        LOG.error('Asked    to    convert    a    non-domain    project    into    a    domain    -    Domain:    %(domain_id)s,    Project    ID:    %(id)s,    Project    Name:    %(project_name)s', {'domain_id': project_ref['domain_id'], 'id': project_ref['id'], 'project_name': project_ref['name']})
        raise exception.DomainNotFound(domain_id=project_ref['id'])
    domain_ref = project_ref.copy()
    for k in ['parent_id', 'domain_id', 'is_domain', 'extra']:
        domain_ref.pop(k, None)
    return domain_ref
