code: def safe_symlink(
      input_file: os.PathLike, soft_link_name: os.PathLike
  ) -> None:
      """Create a symbolic link at ``soft_link_name``, which references ``input_file``.
  
      Think of this as copying ``input_file`` to ``soft_link_name`` with less overhead.
  
      Use symlinks safely. Self-linking loops are prevented. On Windows, file copy is
      used since symlinks may require administrator privileges. An existing link at the
      destination is removed.
      """
      input_file = os.fspath(input_file)
      soft_link_name = os.fspath(soft_link_name)
  
      # Guard against soft linking to oneself
      if input_file == soft_link_name:
          log.warning(
              "No symbolic link created. You are using the original data directory "
              "as the working directory."
          )
          return
  
      # Soft link already exists: delete for relink?
      if os.path.lexists(soft_link_name):
          # do not delete or overwrite real (non-soft link) file
          if not os.path.islink(soft_link_name):
              raise FileExistsError(
                  f"{soft_link_name} exists and is not a link"
              )
          os.unlink(soft_link_name)
  
      if not os.path.exists(input_file):
          raise FileNotFoundError(
              f"trying to create a broken symlink to {input_file}"
          )
  
      if os.name == "nt":
          # Don't actually use symlinks on Windows due to permission issues
          shutil.copyfile(input_file, soft_link_name)
          return
  
      log.debug("os.symlink(%s, %s)", input_file, soft_link_name)
  
      # Create symbolic link using absolute path
      os.symlink(os.path.abspath(input_file), soft_link_name)
  
imports: from __future__ import annotations
  import logging
  import multiprocessing
  import os
  import shutil
  import warnings
  from collections.abc import Iterable, Sequence
  from contextlib import suppress
  from decimal import Decimal
  from io import StringIO
  from math import isclose, isfinite
  from pathlib import Path
  from statistics import harmonic_mean
  from typing import Any, Callable, Generic, TypeVar
  import img2pdf
  import pikepdf
label_desc: Use image node_id 1 for calling a global function with example usage: safe_symlink(input_file, soft_link_name) without return types