When Do Ideologies Produce Alliances? The Holy Roman Empire, 1517–1555