def all_accounts(root):
    """Get all gnucash Accounts,

    Args:
        root: Base Account to start from

    Returns:
        List of all accounts.
    """
    accounts = []

    for account in root.get_children():
        accounts.append(account)

        subaccounts = all_accounts(account)
        for subaccount in subaccounts:
            accounts.append(subaccount)

    return accounts