

def _check_if_role_exists(self, role_name):
    'Method to verify if a particular role exists'
    try:
        self._iam_client.get_role(RoleName=role_name)
    except ClientError as e:
        if (e.response['Error']['Code'] == 'NoSuchEntity'):
            return False
        else:
            raise e
    return True

dataset/ETHPy150Open aws/aws-cli/awscli/customizations/datapipeline/createdefaultroles.py CreateDefaultRoles._check_if_role_exists/original