Python utility function for dealing with paths and folders