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