def file_access_rights(filename, rights, check_above=False):
 if os.path.exists(filename):
  return os.access(filename, rights)
 elif check_above:
  return os.access(os.path.dirname(os.path.abspath(filename)), rights)
 else:
  return False

def file_access_rights ( filename , rights , check_above = False ) : if os . path . exists ( filename ) : return os . access ( filename , rights ) elif check_above : return os . access ( os . path . dirname ( os . path . abspath ( filename ) ) , rights ) else : return False
determines if a file has given rights .