def generate_account_updates()

in src/load_data.py [0:0]


def generate_account_updates(company_name: str, account_data: list):
    existing_accounts = get_accounts_by_company_name(company_name=company_name)
    existing_account_id_list = [record['AccountId'] for record in existing_accounts]
    new_accounts = [account for account in account_data
                    if not account['AccountId'].zfill(12) in existing_account_id_list]
    for account in new_accounts:
        # Since all accounts in the file must be from the same company only the first record must have the company name.
        if account.get('CompanyName') and account['CompanyName'] != company_name:
            raise ValueError(
                "All accounts must belong to the same company."
            )

    return new_accounts