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