def cleandir(dirname):
 try:
  shutil.rmtree(dirname)
 except OSError as exception:
  if (exception.errno != errno.ENOENT):
   raise exception

def cleandir ( dirname ) : try : shutil . rmtree ( dirname ) except OSError as exception : if ( exception . errno != errno . ENOENT ) : raise exception
removes a complete tree .