def remove_accounts_from_group(accounts_query, group):
    """ Remove accounts from group. """

    query = accounts_query.filter(date_deleted__isnull=True)

    for account in query:
        remove_account_from_group(account, group)