  def CreatePolicy(self, name: str, policy_doc: str) -> Tuple[str, bool]:
    """Creates an IAM policy using the name and policy doc passed in.
    If the policy exists already, return the Arn of the existing policy.

    Args:
      name (str): Name for the policy
      policy_doc (str): IAM Policy document as a json string.

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

    Raises:
      ResourceNotFoundError: If the policy failed creation due to already
        existing, but then could not be found
    """
    logger.info('Creating IAM policy {0:s}'.format(name))
    try:
      policy = self.client.create_policy(
        PolicyName=name, PolicyDocument=policy_doc)
      return str(policy['Policy']['Arn']), True
    except self.client.exceptions.EntityAlreadyExistsException as exception:
      logger.info('Policy exists already, using existing')
      policies = self.client.list_policies(Scope='Local')

      while True:
        for policy in policies['Policies']:
          if policy['PolicyName'] == name:
            return str(policy['Arn']), False

        if not policies['IsTruncated']:
          # If we reached here it means the policy was deleted between the
          # creation failure and lookup
          # pylint: disable=line-too-long
          raise errors.ResourceNotFoundError('Could not locate policy with name {0:s} after creation failure due to EntityAlreadyExistsException'
          # pylint: enable=line-too-long
            .format(name), __name__) from exception

        policies = self.client.list_policies(
          Scope='Local', Marker=policies['Marker'])
Creates an IAM policy using the name and policy doc passed in.
If the policy exists already, return the Arn of the existing policy.

Args:
name (str): Name for the policy
policy_doc (str): IAM Policy document as a json string.

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

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