Not going to happen. They don't have that kind of brain capacity to be "trained" in that manner, and there isn't anyway to prevent them from answering the call of nature when it happens. Best you can do is A) check for sausage butt before you get them out (that time before a big poop when they get real fat in the tail behind the vent) B) make sure they aren't pooping/peeing on you as a defense behavior (common for most snake species to evacuate if they are startled/feel threatened) and C) accept the fact that even then you might get pooped/peed on. Want something you can handle with out that risk, get a cat or dog and potty train it.