Make path encoding/decoding helpers a bit closer to python 3 ones