code: def prepare_R_package(
      src_dir: str, dst_dir: str, release_version: str, tmp_dir: str
  ):
      for system, archs in get_sys_arch_list():
          for arch in archs:
              dst_tgz = os.path.join(
                  dst_dir,
                  f"catboost-R-{system}-{arch}-{release_version}.tgz",
              )
              os.rename(
                  os.path.join(
                      src_dir, "R", f"catboost-R-{system}-{arch}.tgz"
                  ),
                  dst_tgz,
              )
  
              # extract so only
              if system == "windows":
                  so_path_in_tgz = (
                      "catboost/inst/libs/x64/libcatboostr.dll"
                  )
                  dst_suffix = ".dll"
              else:
                  so_path_in_tgz = "catboost/inst/libs/libcatboostr.so"
  
                  # there's a confusion what is the proper suffix for R packages binaries on Darwin (.so or .dylib),
                  # but R-package/R/install.R uses .dylib to fetch artifacts
                  dst_suffix = ".dylib" if system == "darwin" else ".so"
  
              extract_file_from_tgz(
                  dst_tgz,
                  so_path_in_tgz,
                  os.path.join(
                      dst_dir,
                      f"libcatboostr-{system}-{arch}-v{release_version}{dst_suffix}",
                  ),
                  tmp_dir,
              )
  
      # legacy names for compatibility
      shutil.copy2(
          os.path.join(
              dst_dir,
              f"catboost-R-darwin-universal2-{release_version}.tgz",
          ),
          os.path.join(
              dst_dir, f"catboost-R-Darwin-{release_version}.tgz"
          ),
      )
      shutil.copy2(
          os.path.join(
              dst_dir, f"catboost-R-linux-x86_64-{release_version}.tgz"
          ),
          os.path.join(
              dst_dir, f"catboost-R-Linux-{release_version}.tgz"
          ),
      )
      shutil.copy2(
          os.path.join(
              dst_dir,
              f"catboost-R-windows-x86_64-{release_version}.tgz",
          ),
          os.path.join(
              dst_dir, f"catboost-R-Windows-{release_version}.tgz"
          ),
      )
  
      shutil.copy2(
          os.path.join(
              dst_dir,
              f"libcatboostr-darwin-universal2-v{release_version}.dylib",
          ),
          os.path.join(dst_dir, f"libcatboostr-darwin.dylib"),
      )
      # copy with different suffix for compatibility
      shutil.copy2(
          os.path.join(dst_dir, f"libcatboostr-darwin.dylib"),
          os.path.join(dst_dir, f"libcatboostr-darwin.so"),
      )
  
      shutil.copy2(
          os.path.join(
              dst_dir,
              f"libcatboostr-linux-x86_64-v{release_version}.so",
          ),
          os.path.join(dst_dir, f"libcatboostr-linux.so"),
      )
      shutil.copy2(
          os.path.join(
              dst_dir,
              f"libcatboostr-windows-x86_64-v{release_version}.dll",
          ),
          os.path.join(dst_dir, f"libcatboostr.dll"),
      )
  
file_path: catboost/ci/prepare_release_artifacts.py
imports: import argparse
  import os
  import shutil
  import tarfile
  import tempfile
label_desc: Use image node_id 4 for calling a global function with example usage: prepare_R_package(src_dir, dst_dir, release_version, tmp_dir) without return types