def check_permissions(path, permission):
 return (oct((os.stat(path).st_mode & 511)) == oct(permission))

def check_permissions ( path , permission ) : return ( oct ( ( os . stat ( path ) . st_mode & 511 ) ) == oct ( permission ) )
check file or directory permissions .