  def CreateRole(self, name: str, assume_role_policy_doc: str) \
    -> Tuple[str, bool]:
    """Create an AWS IAM role. If it exists, return the existing.

    Args;
      name (str): The name of the role.
      assume_role_policy_doc (str): Assume Role policy doc.

    Returns:
      Tuple[str, bool]: A tuple
        str: The Arn of the role.
        bool: True if the role was created, false if it existed already.

    Raises:
      ResourceNotFoundError: If the role failed creation due to already
        existing, but then could not be found
    """
    logger.info('Creating IAM Role {0:s}'.format(name))
    try:
      role = self.client.create_role(RoleName=name,
        AssumeRolePolicyDocument=assume_role_policy_doc)
      return str(role['Role']['Arn']), True
    except self.client.exceptions.EntityAlreadyExistsException as exception:
      logger.info('Role exists already, using existing')
      roles = self.client.list_roles()

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

        roles = self.client.list_roles(Marker=roles['Marker'])
Create an AWS IAM role. If it exists, return the existing.

Args;
name (str): The name of the role.
assume_role_policy_doc (str): Assume Role policy doc.

Returns:
Tuple[str, bool]: A tuple
str: The Arn of the role.
bool: True if the role was created, false if it existed already.

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