def isfile_strict(path):
 try:
  st = os.stat(path)
 except OSError as err:
  if (err.errno in (errno.EPERM, errno.EACCES)):
   raise
  return False
 else:
  return stat.S_ISREG(st.st_mode)

def isfile_strict ( path ) : try : st = os . stat ( path ) except OSError as err : if ( err . errno in ( errno . EPERM , errno . EACCES ) ) : raise return False else : return stat . S_ISREG ( st . st_mode )
same as os .