'Build and return a role assignment query url with provided params.
Available filters are: domain_id, project_id, user_id, group_id,
role_id and inherited_to_projects.'

def build_role_assignment_query_url(self, effective=False, **filters):

    query_params = ('?effective' if effective else '')
    for (k, v) in filters.items():
        query_params += ('?' if (not query_params) else '&')
        if (k == 'inherited_to_projects'):
            query_params += 'scope.OS-INHERIT:inherited_to=projects'
        else:
            if (k in ['domain_id', 'project_id']):
                query_params += 'scope.'
            elif (k not in ['user_id', 'group_id', 'role_id']):
                raise ValueError(("Invalid    key    '%s'    in    provided    filters." % k))
            query_params += ('%s=%s' % (k.replace('_', '.'), v))
    return ('/role_assignments%s' % query_params)
