Oh goodness.. poor thing.

Don't pull it! If it's sticking like that, it could still be stuck to the internal organs, and pulling the poo will pull the organs too.

Is he eating plenty of algae? In FW fish, greens (like peas) work as a laxative. I have no idea if the fish digestive system is much like people's.... if it is diet should help the problem. fiber? oil?