def get_project_groups_roles(request, project):
    """Gets the groups roles in a given project.

    :param request: the request entity containing the login user information
    :param project: the project to filter the groups roles. It accepts both
                    project object resource or project ID

    :returns group_roles: a dictionary mapping the groups and their roles in
                          given project

    """
    groups_roles = collections.defaultdict(list)
    project_role_assignments = role_assignments_list(request,
                                                     project=project)

    for role_assignment in project_role_assignments:
        if not hasattr(role_assignment, 'group'):
            continue
        group_id = role_assignment.group['id']
        role_id = role_assignment.role['id']

        # filter by project_id
        if (role_assignment.scope in 'project' and
                role_assignment.scope['project']['id'] == project):
            groups_roles[group_id].append(role_id)
    return groups_roles
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/api/keystone.py/get_project_groups_roles/swapped operands of `in`