code: def get_stackset_ready_accounts(credentials, account_ids, quiet=True):
      
      api_client = connect_service('sts', credentials, silent=True)
      configured_account_ids = []
      for account_id in account_ids:
          try:
              role_arn = 'arn:aws:iam::%s:role/AWSCloudFormationStackSetExecutionRole' % account_id
              api_client.assume_role(RoleArn=role_arn, RoleSessionName='opinel-get_stackset_ready_accounts')
              configured_account_ids.append(account_id)
          except Exception as e:
              pass
  
      if len(configured_account_ids) != len(account_ids) and not quiet:
          printInfo('Only %d of these accounts have the necessary stack set execution role:' % len(configured_account_ids))
          printDebug(str(configured_account_ids))
      return configured_account_ids
docs: Verify which AWS accounts have been configured for CloudFormation stack set by attempting to assume the stack set execution role
  
      :param credentials:                 AWS credentials to use when calling sts:assumerole
      :param org_account_ids:             List of AWS accounts to check for Stackset configuration
  
      :return:                            List of account IDs in which assuming the stackset execution role worked