def resolve_given_outfile_path(path):
 if (path is None):
  return
 outfile = os.path.expanduser(os.path.expandvars(path))
 if (not os.access(os.path.dirname(os.path.abspath(outfile)), os.W_OK)):
  raise ValueError(('Unable to write to file: %s' % outfile))
 return outfile

def resolve_given_outfile_path ( path ) : if ( path is None ) : return outfile = os . path . expanduser ( os . path . expandvars ( path ) ) if ( not os . access ( os . path . dirname ( os . path . abspath ( outfile ) ) , os . W_OK ) ) : raise ValueError ( ( 'Unable to write to file: %s' % outfile ) ) return outfile
asserts that a path is writable and returns the expanded path .