Its a natural camoflage that is just about on everything. A good example is that aboreal snakes have lighter underbelliesin the way of lighter motley patterns, so that it is harder for predators to see them from the ground when looking skywards and darker topsides so that predatory birds find it harder to see them from above through the trees. No doubt the darker tops of some snakes also aid in extracting the most heat & absorption from the sun, hence Diamond pythons and where they live.