Help with GY-521

Hello I am working on an autonomous quadcopter, and I need help with the stabilization. I have the GY-521 breakout, can someone please help me with the code and understanding how it works, some most guides I find just include a little explanation and the code with no explanation, can you please help me.