How the earth gets magnetism?

Can you answer this question?