What does legend(loc=best) does?

Hello,
how does loc=0 (best) affects the placement of the legend? I can't really
figure out any influence. There is space (on the upper left) where the legend
could be placed without hiding any lines but it's still placed on the upper
right.

Thanks,

Florian