The British method in the age of piracy was to suspend a captured pirate from the bowsprite within a cage and tightly clad by ropes. The seagulls and rodents would make it a very unpleasant way to go and it stood as a warning to anyone thinking about piracy.
Today most nations are overly burdened by their own laws and so most every nation has decided to hand over pirates to Kenya. I can only imagine Kenyan prisons as being not too much better than the bowsprite cage.