If you want them sealed, then I don't know of a good foam for sure.
Great Stuff is good for air leaks in walls, but its not all that waterproof or airtight.
Probably some epoxy fiberglass resin with some kind of substrate.
You could soak a cloth or paper towel with it, and force it in.
When it hardens, not much is going to get past it.
Push it in past the opening, and then put something decorative in the space.
Devcon makes some epoxy rubber called Flexane, that will cure like epoxy in any thickness and does not have to dry like Silicone rubber, and is waterproof and stays flexable so it does not crack and fall out.
Depending on the angle, just fill the end with it and let it harden. You might have to put a plug inside the pipe to stop it from just running inside, and a cap on the end to keep it in place until it hardens.
If you just want to keep the light stuff out, Great Stuff will work, but it needs to be painted or it will turn brown and blow away after the sun hits it for a while.