def makepath(s, as_file=False):
    """Make a path from a string

    Expand out any variables, home squiggles, and normalise it
    See also http://stackoverflow.com/questions/26403972
    """
    if s is None:
        return None
    result = FilePath(s) if (os.path.isfile(s) or as_file) else DirectPath(s)
    return result.expandall()
Make a path from a string

    Expand out any variables, home squiggles, and normalise it
    See also http://stackoverflow.com/questions/26403972