(Addendum below.) This appears to be a green tree python (Morelia viridis, SE Asia and Australia); notice how it remains absolutely motionless but waves its brightly-colored tail, a behavior called “caudal luring.” As this paper in Herpetologica notes:
Caudal luring by ambush-foraging snakes can increase their encounter rates with prey (Neill, 1960). The wiggling of a brightly colored tail presumably mimics the movements made by insect larvae, which are prey items of frogs and lizards (Greene and Campbell, 1972). Frogs and lizards are attracted to the lure and become prey themselves when they move within striking distance of the snake (Greene and Campbell, 1972). The use of this behavior as a foraging strategy has been well documented in viperids, but previous studies did not test whether this behavior varies among age classes or sexes.
Another paper on caudal luring in the green python reports the behavior in young snakes when rodents and lizards (Anolis) were offered. But luring diminished with age, corresponding to a change in the color of the tail tip from bright yellow to the green “ground color” of the adult body. The authors suggest that the lure could be used to attract insectivorous marsupials, birds, and other reptiles. I’m not sure why the behavior and tail color diminish with age—presumably the snakes use other methods of hunting when they’re older.
h/t: Matthew Cobb via Ed Yong (Twitter) via (I think) the snake’s owner.
Addendum by Greg Mayer: I posted on caudal luring in Mexican moccasins a little while back:
The video above is great! I’d never seen that kind of movement, and it clearly seems to be predatory in intent. Just last week, I was giving a demo of a green tree python at the Racine Zoo; I don’t recall if the one we have at the Zoo has a differently colored tail. The species is famous for being yellow or red as juveniles, and turning green when they get bigger. The color change is accompanied by an ecological change from ground-dwelling, lizard-eating juveniles, to canopy-dwelling, bird-eating adults. David Wilson, Robert Heinsohn, and John Endler have shown that the color change makes them less conspicuous in their respective habitats. Jerry’s remark about changing habits as they age is absolutely right– they change color, where they live, and what they eat.
There’s a nearly identically patterned species in South America, the emerald tree boa (Corallus caninus), which has the same ontogenetic color change, and sits on branches the same funny way; I don’t know if they caudal lure or not (the tail is prehensile in both). It’s a remarkable case of convergence, as the species are in different families or subfamilies (depending on if you’re a lumper or splitter).
Caudal movement (which occurs in lizards too) has also been considered a protective behavior, distracting predators from the vital head. There’s some discussion of this in the moccasin post comments. In the tree python, it seems undoubtedly predatory, rather than protective.
For more on snake natural history, with lots on eating and avoiding being eaten see Snakes, by my friend and colleague Harry Greene, one of whose papers is cited above.
Wilson, D., R. Heinsohn, and J.A. Endler. 2007. The adaptive significance of ontogenetic colour change in a tropical python. Biology Letters 3:40-43. pdf