def CopyEBSSnapshotToS3TearDown(
    aws_account: account.AWSAccount,
    instance_profile_name: str,
    iam_details: Dict[str, Dict[str, Any]]
    ) -> None:
  """Removes the IAM components created by CopyEBSSnapshotToS3SetUp, if any
  were created anew.

  Args:
    aws_account (account.AWSAccount): An AWS account object.
    instance_profile_name (str): The name of the instance profile.
    iam_details (Dict[str, Dict[str, Any]]): The Dict returned by the SetUp
      method.
  """
  if iam_details['role']['created'] and iam_details['policy']['created']:
    aws_account.iam.DetachInstanceProfileFromRole(
        iam_details['role']['name'], instance_profile_name)
  if iam_details['profile']['created']:
    aws_account.iam.DetachPolicyFromRole(
        iam_details['policy']['arn'], iam_details['role']['name'])
    aws_account.iam.DeleteInstanceProfile(instance_profile_name)
  if iam_details['role']['created']:
    aws_account.iam.DeleteRole(iam_details['role']['name'])
  if iam_details['policy']['created']:
    aws_account.iam.DeletePolicy(iam_details['policy']['arn'])
Removes the IAM components created by CopyEBSSnapshotToS3SetUp, if any
were created anew.

Args:
aws_account (account.AWSAccount): An AWS account object.
instance_profile_name (str): The name of the instance profile.
iam_details (Dict[str, Dict[str, Any]]): The Dict returned by the SetUp
method.
libcloudforensics/providers/aws/forensics.py