Srimad Bhagavatam Canto 04, Chapter 28, Text 02

SB 4.28.2

ta ekada tu rabhasa
 purañjana-purim nrpa
rurudhur bhauma-bhogadhyam
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
Once the dangerous soldiers attacked the city of Purañjana with great force. Although the city was full of paraphernalia for sense gratification, it was being protected by the old serpent.
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
As one’s body engages in sense gratification, it becomes weaker and weaker daily. Finally the vital force becomes so weak that it is herein compared to a weak serpent. The life air has already been compared to the serpent. When the vital force within the body becomes weak, the body itself also becomes weak. At such a time the death symptoms — that is, the dangerous soldiers of death’s superintendent, Yamaraja — begin to attack very severely. According to the Vedic system, before coming to such a stage one should leave home and take sannyasa to preach the message of God for the duration of life. However, if one sits at home and is served by his beloved wife and children, he certainly becomes weaker and weaker due to sense gratification. When death finally comes, one leaves the body devoid of spiritual assets. At the present time, even the oldest man in the family does not leave home, being attracted by wife, children, money, opulence, dwelling, etc. Thus at the end of life one worries about how his wife will be protected and how she will manage the great family responsibilities. In this way a man usually thinks of his wife before death. According to Bhagavad-gita (8.6):
yam yam vapi smaran bhavam
 tyajaty ante kalevaram
tam tam evaiti kaunteya
 sada tad-bhava-bhavitah
“Whatever state of being one remembers when he quits his body, that state he will attain without fail.”
At the end of life, a person thinks of what he has done throughout his whole life; thus he gets another body (dehantara) according to his thoughts and desires at the end of life. One overly addicted to life at home naturally thinks of his beloved wife at the end of life. Consequently, in the next life he gets the body of a woman, and he also acquires the results of his pious or impious activities. In this chapter the acceptance of a woman’s body by King Purañjana will be thoroughly explained.
Srimad Bhagavatam Canto 04, Chapter 28, Text 01
Srimad Bhagavatam Canto 04, Chapter 28, Text 03