def seed_aws_organization(ctx, owner):
    """Seeds SWAG from an AWS organziation."""
    swag = create_swag_from_ctx(ctx)
    accounts = swag.get_all()
    _ids = [result.get('id') for result in accounts]

    client = boto3.client('organizations')
    paginator = client.get_paginator('list_accounts')
    response_iterator = paginator.paginate()

    count = 0
    for response in response_iterator:
        for account in response['Accounts']:
            if account['Id'] in _ids:
                click.echo(click.style(
                    'Ignoring Duplicate Account.  AccountId: {} already exists in SWAG'.format(account['Id']), fg='yellow')
                )
                continue

            if account['Status'] == 'SUSPENDED':
                status = 'deprecated'
            else:
                status = 'created'

            data = {
                'id': account['Id'],
                'name': account['Name'],
                'description': 'Account imported from AWS organization.',
                'email': account['Email'],
                'owner': owner,
                'provider': 'aws',
                'contacts': [],
                'sensitive': False,
                'status': [{'region': 'all', 'status': status}]
            }

            click.echo(click.style(
                'Seeded Account. AccountName: {}'.format(data['name']), fg='green')
            )

            count += 1
            swag.create(data, dry_run=ctx.dry_run)

    click.echo('Seeded {} accounts to SWAG.'.format(count))
Seeds SWAG from an AWS organziation.