A Thai man's routine visit to the bathroom turned into a terrifying fight with a giant snake.

Atthaporn Boonmakchuay was doing his business on a toilet in his home east of Bangkok when a python emerged through the bowl and bit his penis, outlets reported Wednesday.

The python wouldn't let go, so he screamed for his wife to get a rope, the Thai English-language news site Khaosod English noted. He managed to tie the snake's head to the bathroom door and extricate himself "before he passed out from loss of blood," the site wrote.

According to the Mirror, the man has been hospitalized in stable condition.

As news video shows, the massive python, alive, was taken from the home still stuck in the pipe and bathroom fixture. Workers eventually smashed it to free the python, which was expected to be released back into the wild, outlets reported.

Mirror video A crew carries out the snake after breaking the bathroom fixture in which it was stuck.