<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def get_user_permissions(user):
    '''Returns the queryset of permissions for the given user.'''
    permissions = SeedPermission.objects.all()
    # User must be on a team that grants the permission
    permissions = permissions.filter(seedteam__users=user)
    # The team must be active
    permissions = permissions.filter(seedteam__archived=False)
    # The organization of that team must be active
    permissions = permissions.filter(
        seedteam__organization__archived=False)
    return permissions