def delete_members()

in disableDetective.py [0:0]


def delete_members(d_client: botocore.client.BaseClient, graph_arn: str,
                   account_dict: typing.Dict[str, str]) -> typing.Set[str]:
    """
    delete member accounts for all accounts in the csv that are not present in the graph member set.

    Args:
        - d_client: Detective boto3 client generated from the master session.
        - graph_arn: Graph to add members to.
        - account_dict: Accounts read from the CSV input file.

    Returns:
        Set with the IDs of the successfully deleted accounts.
    """
    try:
        accountIDs = list(account_dict.keys())
        response = d_client.delete_members(GraphArn=graph_arn,
                                        AccountIds=accountIDs)
        for error in response['UnprocessedAccounts']:
            logging.exception(f'Could not delete member for account {error["AccountId"]} in '
                            f'graph {graph_arn}: {error["Reason"]}')
    except e:
        logging.error(f'error when deleting member: {e}')