As long as the wood you take is a hardwood, isn't cedar, pine, and doesn't have a lot of sap it should be alright to use. Let it soak in water for a few weeks changing out the water every so often, then boil it a couple times, bake it at 150F {or however low your oven will go} for about an hour+, smooth out any rough edges. Even doing all of that I would be iffy on using it. If you do go that route keep an eye on your snake and watch for any changes when you put it in the enclosure.
But I suggest you just shell out the money for the drift wood. Boil it a few times and bake it just as a precaution.