code: def rename_if_empty(src, dest, allowable_errors=(errno.EEXIST, errno.ENOTEMPTY)):
    
    try:
      os.rename(src, dest)
    except OSError as e:
      if e.errno in allowable_errors:
        safe_rmtree(src)
      else:
        raise
docs: Rename `src` to `dest` using `os.rename()`.
  
    If an `OSError` with errno in `allowable_errors` is encountered during the rename, the `dest`
    dir is left unchanged and the `src` directory will simply be removed.