def s_client(self):
        """
        Setup and return the SAML client with specified config
        """
        acs_url = url_for('sso',
                          _scheme='https',
                          _external=True)
        logger.debug('SSO ACS URL: {}'.format(acs_url))
        logout_url = url_for('logout',
                             _scheme='https',
                             _external=True)
        try:
            with open(self.meta_file, 'r') as meta_fh:
                meta_len = len(meta_fh.read())
            if meta_len < 1:
                try:
                    res = requests.get(self.meta_url)
                    with open(self.meta_file, 'w') as meta_fh:
                        meta_fh.write(res.text)
                except Exception as err:
                    logger.error('Invalid SAML metadata file/s provided:\n{}'.format(err))
        except FileNotFoundError as err:
            res = requests.get(self.meta_url)
            with open(self.meta_file, 'w') as meta_fh:
                meta_fh.write(res.text)
            #logger.error('Invalid SAML metadata file provided')
        ###***review all of these settings
        settings = {
            'metadata': {
                "local": [self.meta_file]
                },
            'service': {
                'sp': {
                    'name_id_format': 'None',
                    'endpoints': {
                        'assertion_consumer_service': [
                            (acs_url, BINDING_HTTP_REDIRECT),
                            (acs_url, BINDING_HTTP_POST)
                        ],
                        'single_logout_service': [(logout_url, BINDING_HTTP_REDIRECT)]
                    },
                    ###***update some of these if possible
                    'allow_unsolicited': True,
                    #'allow_unknown_attributes': True,
                    'authn_requests_signed': False,
                    'logout_requests_signed': True,
                    'want_assertions_signed': True,
                    'want_response_signed': False,
                    'attribute_map_dir': './attributemaps',
                },
            },
        }
        sp_config = Saml2Config()
        sp_config.load(settings)
        sp_config.entityid = self.entity_id
        sp_config.allow_unknown_attributes = True
        client = Saml2Client(config=sp_config)
        return client

        Setup and return the SAML client with specified config
        
crackq/auth.py