  def CreateInstanceProfile(self, name: str) -> Tuple[str, bool]:
    """Create an EC2 instance Profile. If the profile exists already, returns
    the Arn of the existing.

    Args:
      name (str): The name of the instance profile.

    Returns:
      Tuple[str, bool]: A tuple containing:
        str: The instance profile Amazon Resource Name (ARN).
        bool: True if the instance profile was created, False if it existed
          already.

    Raises:
      ResourceNotFoundError: If the profile failed creation due to already
        existing, but then could not be found
    """
    logger.info('Creating IAM Instance Profile {0:s}'.format(name))
    try:
      profile = self.client.create_instance_profile(InstanceProfileName=name)
      return str(profile['InstanceProfile']['Arn']), True
    except self.client.exceptions.EntityAlreadyExistsException as exception:
      logger.info('Instance Profile exists already, using existing')
      profiles = self.client.list_instance_profiles()

      while True:
        for profile in profiles['InstanceProfiles']:
          if profile['InstanceProfileName'] == name:
            return str(profile['Arn']), False
        if not profiles['IsTruncated']:
          # If we reached here it means the profile was deleted between the
          # creation failure and lookup
          # pylint: disable=line-too-long
          raise errors.ResourceNotFoundError('Could not locate instance profile with name {0:s} after creation failure due to EntityAlreadyExistsException'
          # pylint: enable=line-too-long
            .format(name), __name__) from exception

        profiles = self.client.list_instance_profiles(Marker=profiles['Marker'])
Create an EC2 instance Profile. If the profile exists already, returns
the Arn of the existing.

Args:
name (str): The name of the instance profile.

Returns:
Tuple[str, bool]: A tuple containing:
str: The instance profile Amazon Resource Name (ARN).
bool: True if the instance profile was created, False if it existed
already.

Raises:
ResourceNotFoundError: If the profile failed creation due to already
existing, but then could not be found
libcloudforensics/providers/aws/internal/iam.py