def create_and_check_dir(path):
 if (not os.path.exists(path)):
  os.makedirs(path)
 elif (not os.access(path, os.W_OK)):
  raise OSError('DATA_DIR {0} is not writable!'.format(path))

def create_and_check_dir ( path ) : if ( not os . path . exists ( path ) ) : os . makedirs ( path ) elif ( not os . access ( path , os . W_OK ) ) : raise OSError ( 'DATA_DIR {0} is not writable!' . format ( path ) )
ensure directory exists and is writable by us .