get the mage function