.. versionadded:: 2016.11.0

    Ensure the SAML provider with the specified name is present.

    name (string)
        The name of the SAML provider.

    saml_metadata_document (string)
        The xml document of the SAML provider.

    region (string)
        Region to connect to.

    key (string)
        Secret key to be used.

    keyid (string)
        Access key to be used.

    profile (dict)
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.

def saml_provider_present(name, saml_metadata_document, region=None, key=None, keyid=None, profile=None):
    '''
    .. versionadded:: 2016.11.0

    Ensure the SAML provider with the specified name is present.

    name (string)
        The name of the SAML provider.

    saml_metadata_document (string)
        The xml document of the SAML provider.

    region (string)
        Region to connect to.

    key (string)
        Secret key to be used.

    keyid (string)
        Access key to be used.

    profile (dict)
        A dict with region, key and keyid, or a pillar key (string)
        that contains a dict with region, key and keyid.
    '''
    ret = {'name': name, 'result': True, 'comment': '', 'changes': {}}
    if 'salt://' in saml_metadata_document:
        try:
            saml_metadata_document = __salt__['cp.get_file_str'](saml_metadata_document)
            ET.fromstring(saml_metadata_document)
        except IOError as e:
            log.debug(e)
            ret['comment'] = 'SAML document file {0} not found or could not be loaded'.format(name)
            ret['result'] = False
            return ret
    for provider in __salt__['boto_iam.list_saml_providers'](region=region,
                                                             key=key, keyid=keyid,
                                                             profile=profile):
        if provider == name:
            ret['comment'] = 'SAML provider {0} is present.'.format(name)
            return ret
    if __opts__['test']:
        ret['comment'] = 'SAML provider {0} is set to be create.'.format(name)
        ret['result'] = None
        return ret
    created = __salt__['boto_iam.create_saml_provider'](name, saml_metadata_document,
                                                        region=region, key=key, keyid=keyid,
                                                        profile=profile)
    if created:
        ret['comment'] = 'SAML provider {0} was created.'.format(name)
        ret['changes']['new'] = name
        return ret
    ret['result'] = False
    ret['comment'] = 'SAML provider {0} failed to be created.'.format(name)
    return ret