def METHOD_NAME(self, missing_idp_metadata_ok=False):
    settings = {
        "entityid": self.entity_id(),
        "service": {
            "sp": {
                "name_id_format": NAMEID_FORMAT_EMAILADDRESS,
                "endpoints": {
                    "assertion_consumer_service": [
                        (self.acs_url(), BINDING_HTTP_POST),
                    ],
                },
                # skip built-in pysaml2 cache
                # https://github.com/IdentityPython/pysaml2/blob/9e5c9ab426ce8e602ca769c7fc259a2fb1325877/example/sp-wsgi/sp.py#L353  # NOQA
                "allow_unsolicited": True,
                "authn_requests_signed": False,
                "logout_requests_signed": True,
                "want_assertions_signed": True,
                "want_response_signed": False,
            },
        },
    }
    try:
        settings["metadata"] = {"inline": [self.instance.config["idp_metadata"]]}
    except KeyError:
        if missing_idp_metadata_ok:
            pass
        else:
            raise
    sp_config = Saml2Config()
    sp_config.allow_unknown_attributes = True
    sp_config.load(settings)
    return sp_config