def _user_in_groups(user, group_names):
    """
    Function to verify if a user belongs to any of the groups given.
    """
    # If the use is staff (admin, root) we dont need to verify the groups
    if user.is_staff:
        return True
    
    return set(group.name
        for group in user.groups.all()).intersection(group_names)