def extract_idp_data_from_parsed_data(data):
    """
    Transform data returned by the OneLogin_Saml2_IdPMetadataParser into the
    expected IdP dict shape.
    """
    idp = data.get('idp', {})

    # In some scenarios the IDP sticks the x509cert in the x509certMulti
    # parameter
    cert = idp.get('x509cert', idp.get('x509certMulti', {}).get('signing', [None])[0])

    return {
        'entity_id': idp.get('entityId'),
        'sso_url': idp.get('singleSignOnService', {}).get('url'),
        'slo_url': idp.get('singleLogoutService', {}).get('url'),
        'x509cert': cert,
    }