Black-headed python

Their black-colored heads play an important role in thermoregulation.

An excerpt from the article 18 facts about Black-headed python
As an ectothermic animal, pythons need to bask in the sun to warm their bodies. Black head allows them to absorb sun energy quicker.