2-stroke exhaust pipe

With a regular 4-stroke engine, the exhaust pipe is an ordinaru steel tube of uniform diameter.
But a 2-stroke exhaust is a convoluted pretzel-like thing that gets fatter and skinnier as the exhaust travels through
it. What is the rational behind this strange bit of engineering?

Not on any 2-stroke I have ever seen. Are you sure what you are seeing is not specific to a particular engine and/or application?

How Two-Stroke Expansion Chambers Work, and Why You Should Care:

Most two-stroke dirt bikes (that I have seen) have an exaust pipe like the one enolancooper describes, Shiva’s link does a very good job of explaining them. I guess complicated exhausts are mostly seen on high performance two-strokes.