Based on the monk's Vinaya (rules), intentionally killing a human being results in immediate expulsion from the monastic community where as killing a snake does not. Therefore, killing an infant is far more serious than killing a snake.
This is based on the natural laws of kamma known within our heart. If we must kill the snake to save the infant, we should kill the snake because if we allow the snake to kill the infant, we will feel great regret & remorse in our heart &, even worse, other people will blame us for our lack of compassion towards the child. We may be socially ostracised & rejected.
The snake was murdering the child thus the snake will reap its 'own kamma' (even though, in reality, animals are not subject to the laws of kamma).
The scriptures (AN 6.63) teach 'kamma is intention' & 'kamma only comes into play due to sense contact'. Therefore, the only repercussions/consequences of killing the snake will be known within your own heart & nowhere else.
When I lived in Thailand, alone near a village, I walked passed a very large cobra laying across the road to the village. Upon closer inspection, the cobra was fighting with an even larger python and had its jaws wrapped around the python's neck. A monk's house was nearby so I informed the monk, who returned with a big stick and hit the cobra until the cobra detached. We did this to save the cobra's life, since it could easily be crushed by a motor vehicle driving to the village.
On another occasion, a large cobra was in the visitor's quarters. Again, we had to use a large stick to remove the cobra. Although cobras are our friends, sometimes we must be firm with them.