def METHOD_NAME(service: BaseService) -> HapCredentials:
    """Extract credentials from service based on what's supported."""
    if service.credentials is not None:
        return parse_credentials(service.credentials)
    flags = parse_features(
        service.properties.get("features", service.properties.get("ft", "0x0"))
    )
    if (
        AirPlayFlags.SupportsSystemPairing in flags
        or AirPlayFlags.SupportsCoreUtilsPairingAndEncryption in flags
    ):
        return TRANSIENT_CREDENTIALS
    return NO_CREDENTIALS