def setup(setup_func): def mkdir_handler(err, result): setup_func() def exists_handler(err, exists): if exists: def delete_handler(err, result): FileSystem.mkdir(FILEDIR, handler=mkdir_handler) FileSystem.delete_recursive(FILEDIR, delete_handler) else: FileSystem.mkdir(FILEDIR, handler=mkdir_handler) FileSystem.exists(FILEDIR, exists_handler)