def verify_directory(dir):
 tries = 0
 while (not os.access(dir, os.F_OK)):
  try:
   tries += 1
   os.makedirs(dir)
  except:
   if (tries > 5):
    raise

def verify_directory ( dir ) : tries = 0 while ( not os . access ( dir , os . F_OK ) ) : try : tries += 1 os . makedirs ( dir ) except : if ( tries > 5 ) : raise
create and/or verify a filesystem directory .