You are given two data structures: 1. accounts: a list of dicts, each with accountId (string) and parent (string or None), forming a tree with no cycles. Example: [{"accountId": "org_1", "parent": None}, {"accountId": "wksp_1", "parent": "org_1"}, ...] 2. user_role_assignments: a list of dicts, each with userId, accountId, and role fields.…