def safe_rmtree(directory):
 if os.path.islink(directory):
  safe_delete(directory)
 else:
  shutil.rmtree(directory, ignore_errors=True)

def safe_rmtree ( directory ) : if os . path . islink ( directory ) : safe_delete ( directory ) else : shutil . rmtree ( directory , ignore_errors = True )
delete a directory if its present .