in functions/source/c1c_controltower_lifecycle.py [0:0]
def get_accounts():
account_ids = []
client = boto3.client("organizations")
paginator = client.get_paginator("list_accounts")
page_iterator = paginator.paginate()
for page in page_iterator:
for account in page.get("Accounts"):
account_ids.append(account.get("Id"))
return account_ids