Given this paragraph about magnesium, how is magnesium obtained?
Magnesium is mainly obtained by electrolysis of magnesium salts obtained from brine.