def METHOD_NAME(payload: WildValue) -> str:
    data = {
        "series_title": payload["series"]["title"].tame(check_string),
        "series_number": payload["episodes"][0]["seasonNumber"].tame(check_int),
        "episode_number": payload["episodes"][0]["episodeNumber"].tame(check_int),
        "episode_name": payload["episodes"][0]["title"].tame(check_string),
        "new_quality": payload["episodeFile"]["quality"].tame(check_string),
        "old_quality": payload["deletedFiles"][0]["quality"].tame(check_string),
    }
    return SONARR_MESSAGE_TEMPLATE_EPISODE_IMPORTED_UPGRADE.format(**data)