Many snakes will choose to do that from time to time, especially if they're about to enter a shed, but if it's doing it for an extended period, then it usually means mites, the snake is too hot, or the humidity in the enclosure is too low.