def safe_concurrent_rename(src, dst):
 if os.path.isdir(src):
  safe_rmtree(dst)
 else:
  safe_delete(dst)
 try:
  shutil.move(src, dst)
 except IOError as e:
  if (e.errno != errno.EEXIST):
   raise

def safe_concurrent_rename ( src , dst ) : if os . path . isdir ( src ) : safe_rmtree ( dst ) else : safe_delete ( dst ) try : shutil . move ( src , dst ) except IOError as e : if ( e . errno != errno . EEXIST ) : raise
rename src to dst .