Assuming groups is always an iterable (even if it's an empty one), this can also simplify down to:

```python
return [
    {'course_id': course_id, 'content_id': content_id, 'group_id': group.group_id}
    for group in groups
]
```