def METHOD_NAME(self, raw_xml: str) -> ServiceProviderMetadata:
    """Parse raw XML to ServiceProviderMetadata"""
    root = fromstring(raw_xml.encode())
    entity_id = root.attrib["entityID"]
    sp_sso_descriptors = root.findall(f"{{{NS_SAML_METADATA}}}SPSSODescriptor")
    if len(sp_sso_descriptors) < 1:
        raise ValueError("no SPSSODescriptor objects found.")
    # For now we'll only look at the first descriptor.
    # Even if multiple descriptors exist, we can only configure one
    descriptor = sp_sso_descriptors[0]
    auth_n_request_signed = False
    if "AuthnRequestsSigned" in descriptor.attrib:
        auth_n_request_signed = descriptor.attrib["AuthnRequestsSigned"].lower() == "true"
    assertion_signed = False
    if "WantAssertionsSigned" in descriptor.attrib:
        assertion_signed = descriptor.attrib["WantAssertionsSigned"].lower() == "true"
    acs_services = descriptor.findall(f"{{{NS_SAML_METADATA}}}AssertionConsumerService")
    if len(acs_services) < 1:
        raise ValueError("No AssertionConsumerService found.")
    acs_service = acs_services[0]
    acs_binding = {
        SAML_BINDING_REDIRECT: SAMLBindings.REDIRECT,
        SAML_BINDING_POST: SAMLBindings.POST,
    }[acs_service.attrib["Binding"]]
    acs_location = acs_service.attrib["Location"]
    signing_keypair = self.get_signing_cert(root)
    if signing_keypair:
        self.check_signature(root, signing_keypair)
    return ServiceProviderMetadata(
        entity_id=entity_id,
        acs_binding=acs_binding,
        acs_location=acs_location,
        auth_n_request_signed=auth_n_request_signed,
        assertion_signed=assertion_signed,
        signing_keypair=signing_keypair,
    )