importosimporttarfiledefmain(a):path="HW"+str(a)out_fname='HW'+str(a)+'.tar.gz'url="http://repolab.colab.duke.edu:8005/courses/proxy/cs301/jpax/"+out_fnameos.popen('curl -LO '+url).read()tar=tarfile.open(out_fname)tar.extractall()tar.close()os.remove(out_fname)base_dir=os.path.abspath(path)# Get absolute path of the target directoryforroot,dirs,filesinos.walk(base_dir,topdown=False):fornameindirs:ifname!="wdir_msg":target_dir=os.path.join(root,name)ifos.path.exists(target_dir):print(f'Accessing {target_dir}')os.chdir(target_dir)os.popen('make init-pull').read()else:print(f'Error: {target_dir} does not exist or cannot be accessed')if__name__=="__main__":a=input("Enter HW#: ")main(a)